pub enum MergePolicy {
KeyUnion,
Exclusive,
Cas,
Accumulate,
}Expand description
How concurrent writers of one shared resource are reconciled.
There is deliberately no “last writer wins” variant: silently discarding a differing value is the behaviour this contract removes. Every accepted policy either refuses the conflict or was chosen in advance for it.
Variants§
KeyUnion
Disjoint keys merge; a key already written by a different writer with different content is an explicit conflict. The default, because it is the only policy that accepts the common disjoint case without ever discarding a differing value.
Exclusive
The resource accepts writes from the one writer the plan names; any other writer is refused.
Cas
Every write is checked against the revision the writer read.
Accumulate
The resource holds a collection: a key already written is merged with the incoming value as a canonical set union of the two arrays.
This is the policy for a key whose declared meaning is “the set of
contributions from the members of one node visit” — the results a
workset’s items produce, for instance. It is the only merge of
concurrent producers into one collection that is commutative,
associative, idempotent and content preserving: completion order stays
unobservable, a re-delivered contribution does not count twice, and no
member’s value is dropped. Its members must therefore be independent by
construction; two writers disagreeing about one value still belong to
a scalar key, where KeyUnion refuses the disagreement.
Trait Implementations§
Source§impl Clone for MergePolicy
impl Clone for MergePolicy
Source§fn clone(&self) -> MergePolicy
fn clone(&self) -> MergePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MergePolicy
Source§impl Debug for MergePolicy
impl Debug for MergePolicy
Source§impl Default for MergePolicy
impl Default for MergePolicy
Source§fn default() -> MergePolicy
fn default() -> MergePolicy
Source§impl<'de> Deserialize<'de> for MergePolicy
impl<'de> Deserialize<'de> for MergePolicy
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MergePolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MergePolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for MergePolicy
Source§impl PartialEq for MergePolicy
impl PartialEq for MergePolicy
Source§impl Serialize for MergePolicy
impl Serialize for MergePolicy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for MergePolicy
Auto Trait Implementations§
impl Forget for MergePolicy
impl Freeze for MergePolicy
impl Move for MergePolicy
impl RefUnwindSafe for MergePolicy
impl Send for MergePolicy
impl Sync for MergePolicy
impl Unpin for MergePolicy
impl UnsafeUnpin for MergePolicy
impl UnwindSafe for MergePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.