pub struct LocalReplica<C: Crdt> { /* private fields */ }Expand description
Owns the OS lock for its entire lifetime. No Clone or mutable state/log access is exposed. Contention yields a read-only instance whose writes fail.
Implementations§
Source§impl<C: Crdt> LocalReplica<C>
impl<C: Crdt> LocalReplica<C>
pub fn state(&self) -> &C
pub fn log(&self) -> &EventLog<C::Delta>
pub fn ticket(&self) -> WriteTicket
Sourcepub fn allocation_bytes(&self) -> Vec<u8> ⓘ
pub fn allocation_bytes(&self) -> Vec<u8> ⓘ
Ordinary allocation metadata, independent of the lock generation.
Sourcepub fn renew(&mut self, ticket: WriteTicket) -> Result<WriteTicket, LocalError>
pub fn renew(&mut self, ticket: WriteTicket) -> Result<WriteTicket, LocalError>
Revoke outstanding tickets while retaining the same exclusive OS lock. I/O uncertainty disables writes. This does not recover a replica.
Sourcepub fn receive(
&mut self,
ticket: WriteTicket,
record: Record<C::Delta>,
) -> Result<Admission, LocalError>
pub fn receive( &mut self, ticket: WriteTicket, record: Record<C::Delta>, ) -> Result<Admission, LocalError>
Validate ownership and the local lease BEFORE calling M1 admission. Remote redelivery and reordering do not require the receiver to own the author’s coordinate. They require the record to carry its author’s space.
Sourcepub fn append(
&mut self,
ticket: WriteTicket,
delta: C::Delta,
) -> Result<Record<C::Delta>, LocalError>
pub fn append( &mut self, ticket: WriteTicket, delta: C::Delta, ) -> Result<Record<C::Delta>, LocalError>
Append an existing delta in the configured writer’s space. No allocation or state mutation occurs on refusal, exhaustion, duplicate or collision.
Source§impl LocalReplica<GCounter>
impl LocalReplica<GCounter>
pub fn counter(root: &Path, config: WriterConfig) -> Result<Self, LocalError>
pub fn bump( &mut self, ticket: WriteTicket, tally: u64, ) -> Result<Record<GCounterDelta>, LocalError>
Source§impl LocalReplica<OrSet<String, u64>>
impl LocalReplica<OrSet<String, u64>>
pub fn utf8_set(root: &Path, config: WriterConfig) -> Result<Self, LocalError>
pub fn add( &mut self, ticket: WriteTicket, element: String, ) -> Result<Record<OrSetDelta<String, u64>>, LocalError>
pub fn remove( &mut self, ticket: WriteTicket, element: &String, ) -> Result<Record<OrSetDelta<String, u64>>, LocalError>
Trait Implementations§
Source§impl<C: Crdt> Drop for LocalReplica<C>
impl<C: Crdt> Drop for LocalReplica<C>
Auto Trait Implementations§
impl<C> Freeze for LocalReplica<C>where
C: Freeze,
impl<C> RefUnwindSafe for LocalReplica<C>
impl<C> Send for LocalReplica<C>
impl<C> Sync for LocalReplica<C>
impl<C> Unpin for LocalReplica<C>
impl<C> UnsafeUnpin for LocalReplica<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for LocalReplica<C>
Blanket Implementations§
Source§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
Source§fn type_id(&self) -> TypeId
fn type_id(&self) -> TypeId
TypeId of self. Read moreSource§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
Source§fn borrow(&self) -> &T
fn borrow(&self) -> &T
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, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
Source§fn into(self) -> U
fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.