pub enum WritePrecondition {
CreateOnly,
Match(String),
}Expand description
Required optimistic-concurrency condition for a plugin write.
§Guarantees per backend
On a git vault both conditions are enforced inside the substrate’s commit
section against the tree being committed, so they are genuinely atomic — a
racing write loses the ref CAS and the whole changeset aborts.
On a direct vault Self::CreateOnly is enforced by an exclusive file
creation, so it is also atomic. Self::Match is a
read-compare-then-write against the working tree: it reliably catches a
change that happened before the comparison, but two writers that interleave
inside that window can still both proceed. Callers needing a hard guarantee
should use a git-backed vault.
Variants§
CreateOnly
Refuse if the target already exists.
Match(String)
Replace only the exact version previously returned by VaultApi::read_note.
Trait Implementations§
Source§impl Clone for WritePrecondition
impl Clone for WritePrecondition
Source§fn clone(&self) -> WritePrecondition
fn clone(&self) -> WritePrecondition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WritePrecondition
impl Debug for WritePrecondition
Source§impl<'de> Deserialize<'de> for WritePrecondition
impl<'de> Deserialize<'de> for WritePrecondition
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 Eq for WritePrecondition
Source§impl PartialEq for WritePrecondition
impl PartialEq for WritePrecondition
Source§impl Serialize for WritePrecondition
impl Serialize for WritePrecondition
impl StructuralPartialEq for WritePrecondition
Auto Trait Implementations§
impl Freeze for WritePrecondition
impl RefUnwindSafe for WritePrecondition
impl Send for WritePrecondition
impl Sync for WritePrecondition
impl Unpin for WritePrecondition
impl UnsafeUnpin for WritePrecondition
impl UnwindSafe for WritePrecondition
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.