pub struct OrSet<T: Ord + Clone> { /* private fields */ }Expand description
An observed-remove set of T.
Implementations§
Source§impl<T: Ord + Clone> OrSet<T>
impl<T: Ord + Clone> OrSet<T>
Sourcepub fn remove(&mut self, add_id: AddId) -> Result<(), UnobservedRemove>
pub fn remove(&mut self, add_id: AddId) -> Result<(), UnobservedRemove>
Tombstone add_id. Returns UnobservedRemove if no add for it was ever observed
locally (a fabricated remove), rather than silently no-oping.
Sourcepub fn merge(&mut self, other: &Self)
pub fn merge(&mut self, other: &Self)
Merge another replica’s state: the union of adds and of removes. Commutative, associative, idempotent — order of arrival does not matter.
Sourcepub fn value(&self) -> BTreeSet<T>
pub fn value(&self) -> BTreeSet<T>
The current logical value: every element whose add_id is not tombstoned.
Sourcepub fn max_add_counter_for(&self, device: &Uuid) -> Option<u64>
pub fn max_add_counter_for(&self, device: &Uuid) -> Option<u64>
The highest add_id.counter this set has ever observed from device, or None if it
has observed none.
Deliberately spans tombstoned adds as well as live ones: a removed add still burned
its counter, so the high-water mark a restarting device reseeds from
(Counter::reseed_from_max) must count it.
Using entries here instead would let a device re-issue the add_id of
a tag it had removed, aliasing two distinct adds — exactly the failure the add-id binding
rule exists to prevent (SSoT: Metadata — Add-id Binding).
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for OrSet<T>
impl<'de, T> Deserialize<'de> for OrSet<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<T: Eq + Ord + Clone> Eq for OrSet<T>
impl<T: Ord + Clone> StructuralPartialEq for OrSet<T>
Auto Trait Implementations§
impl<T> Freeze for OrSet<T>
impl<T> RefUnwindSafe for OrSet<T>where
T: RefUnwindSafe,
impl<T> Send for OrSet<T>where
T: Send,
impl<T> Sync for OrSet<T>where
T: Sync,
impl<T> Unpin for OrSet<T>
impl<T> UnsafeUnpin for OrSet<T>
impl<T> UnwindSafe for OrSet<T>where
T: RefUnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more