pub enum Precondition {
NodeUnchangedSince {
key: String,
expected: u64,
},
NodeAbsent {
key: String,
},
}Expand description
A precondition for a compare-and-set batch write.
All preconditions in a GraphDb::write_batch_cas or
crate::SharedDb::submit_batch_cas call are checked atomically before
any operation in the batch is applied. If any precondition fails, the
entire batch is rejected with GraphError::CasConflict and no WAL frame
is written.
§Touch definition
A node’s last-change commit (last_changed) is updated when any of the
following state-changing WAL records touch it:
InsertNode/InsertNodeId— the newly-inserted node.SetProp/SetPropId/RemoveProp— the property-bearing node.InsertEdge/InsertEdgeId/DeleteEdge— both src and dst endpoints (an edge change touches both sides).DeleteNode— the node is tombstoned;last_changedreturnsNonefor deleted keys so the pre-deletion entry is never observed.
History markers (DerivedEdgeAdded / DerivedEdgeRetracted) are
state no-ops. The underlying mutation that triggered rule firing already
updated the relevant nodes’ last-change entries. Rule-management records
(CreateRule, DeleteRule, RebuildRule) and view/full-text declarations
do not touch any node’s last-change.
Variants§
NodeUnchangedSince
The node’s last-change commit must equal expected.
Fails with GraphError::CasConflict when:
- The node does not exist (
last_changedreturnsNone), or - The recorded commit seq does not match
expected.
NodeAbsent
The node must not exist (not inserted, or already deleted).
Fails with GraphError::CasConflict (expected=u64::MAX,
actual=last_changed(key).unwrap_or(0)) when the node is live.
Trait Implementations§
Source§impl Clone for Precondition
impl Clone for Precondition
Source§fn clone(&self) -> Precondition
fn clone(&self) -> Precondition
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 Precondition
impl Debug for Precondition
impl Eq for Precondition
Source§impl PartialEq for Precondition
impl PartialEq for Precondition
impl StructuralPartialEq for Precondition
Auto Trait Implementations§
impl Freeze for Precondition
impl RefUnwindSafe for Precondition
impl Send for Precondition
impl Sync for Precondition
impl Unpin for Precondition
impl UnsafeUnpin for Precondition
impl UnwindSafe for Precondition
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.