pub trait SetBias:
Default
+ Clone
+ Send
+ 'static {
// Required method
fn resolve(
local_has_dots: bool,
remote_has_dots: bool,
local_removed: bool,
remote_removed: bool,
) -> bool;
}Expand description
Resolution strategy for concurrent add/remove conflicts.
When a replica adds an element while another concurrently removes it, the bias determines which operation wins. This trait defines the conflict resolution policy.
§Built-in Strategies
AddWins: Concurrent add survives concurrent remove (optimistic)RemoveWins: Concurrent remove beats concurrent add (conservative)
§Implementation
Implement this trait to create custom conflict resolution strategies.
The resolve method receives information about the local and remote
states and returns true if the element should be kept.
Required Methods§
Sourcefn resolve(
local_has_dots: bool,
remote_has_dots: bool,
local_removed: bool,
remote_removed: bool,
) -> bool
fn resolve( local_has_dots: bool, remote_has_dots: bool, local_removed: bool, remote_removed: bool, ) -> bool
Resolve whether to keep an element based on concurrent operations.
§Parameters
local_has_dots: This replica has active dots for the elementremote_has_dots: Other replica has active dots for the elementlocal_removed: This replica saw and removed the elementremote_removed: Other replica saw and removed the element
§Returns
true if the element should be kept, false if it should be removed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.