pub struct CausalSession { /* private fields */ }Expand description
A causal-consistency session over one or more replicas of a document.
Implementations§
Source§impl CausalSession
impl CausalSession
pub fn new() -> Self
Sourcepub fn token(&self) -> &[u8] ⓘ
pub fn token(&self) -> &[u8] ⓘ
The session’s causal token (the observed state-vector frontier).
Sourcepub fn record_write(&mut self, doc: &CrdtDoc) -> Outcome
pub fn record_write(&mut self, doc: &CrdtDoc) -> Outcome
Record a local write: the session has now observed everything in doc,
including the write just made (read-your-writes). Returns Outcome::Local
— written and offline-durable, propagation is asynchronous.
Sourcepub fn read(&mut self, doc: &CrdtDoc) -> Outcome
pub fn read(&mut self, doc: &CrdtDoc) -> Outcome
Attempt a causal read of doc. If doc has caught up to the session’s
frontier, the read is served (Committed(Causal)) and the token advances
to doc’s (≥) frontier — so the session never regresses (monotonic reads).
If doc is behind, the read is honestly Outcome::Stale and the token
is not advanced.
Trait Implementations§
Source§impl Clone for CausalSession
impl Clone for CausalSession
Source§fn clone(&self) -> CausalSession
fn clone(&self) -> CausalSession
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CausalSession
impl Debug for CausalSession
Source§impl Default for CausalSession
impl Default for CausalSession
Source§fn default() -> CausalSession
fn default() -> CausalSession
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CausalSession
impl RefUnwindSafe for CausalSession
impl Send for CausalSession
impl Sync for CausalSession
impl Unpin for CausalSession
impl UnsafeUnpin for CausalSession
impl UnwindSafe for CausalSession
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
Mutably borrows from an owned value. Read more