pub enum Exclusivity {
Atomic,
BestEffort,
}Expand description
Whether a backend’s write_new is exclusive
by construction, or only by a check the backend performs itself.
A consumer reaches for write_new to make a coupled-record mismatch
unreachable rather than merely unlikely, and that reasoning is only
valid against a backend whose store offers a create-if-absent primitive.
So the claim is exposed rather than assumed.
The default is BestEffort: a backend that says nothing
understates its guarantee. Overstating it hands a consumer back exactly
the race the method exists to remove, which is the more expensive direction
to be wrong in.
Variants§
Atomic
The underlying store creates-if-absent in one indivisible step, so two
concurrent write_new calls cannot both succeed. Exactly one racer
establishes the record and every other receives
KeystoreError::AlreadyExists.
BestEffort
The backend checks for the key and then writes. Correct when uncontended, but two concurrent calls can both observe absence and both write, so a consumer MUST NOT rely on this to make a coupled mismatch unreachable.
The store offers no create-if-absent primitive — not a defect in the backend, and the reason this is reported rather than hidden.
Trait Implementations§
Source§impl Clone for Exclusivity
impl Clone for Exclusivity
Source§fn clone(&self) -> Exclusivity
fn clone(&self) -> Exclusivity
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 Exclusivity
Source§impl Debug for Exclusivity
impl Debug for Exclusivity
Source§impl Display for Exclusivity
impl Display for Exclusivity
impl Eq for Exclusivity
Source§impl PartialEq for Exclusivity
impl PartialEq for Exclusivity
impl StructuralPartialEq for Exclusivity
Auto Trait Implementations§
impl Freeze for Exclusivity
impl RefUnwindSafe for Exclusivity
impl Send for Exclusivity
impl Sync for Exclusivity
impl Unpin for Exclusivity
impl UnsafeUnpin for Exclusivity
impl UnwindSafe for Exclusivity
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,
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