Skip to main content

LocalReplica

Struct LocalReplica 

Source
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>
where C::Delta: OwnedDelta + Clone + PartialEq,

Source

pub fn state(&self) -> &C

Source

pub fn log(&self) -> &EventLog<C::Delta>

Source

pub fn ticket(&self) -> WriteTicket

Source

pub fn allocation_bytes(&self) -> Vec<u8>

Ordinary allocation metadata, independent of the lock generation.

Source

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.

Source

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.

Source

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>

Source

pub fn counter(root: &Path, config: WriterConfig) -> Result<Self, LocalError>

Source

pub fn bump( &mut self, ticket: WriteTicket, tally: u64, ) -> Result<Record<GCounterDelta>, LocalError>

Source§

impl LocalReplica<OrSet<String, u64>>

Source

pub fn utf8_set(root: &Path, config: WriterConfig) -> Result<Self, LocalError>

Source

pub fn add( &mut self, ticket: WriteTicket, element: String, ) -> Result<Record<OrSetDelta<String, u64>>, LocalError>

Source

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>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<C> Freeze for LocalReplica<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for LocalReplica<C>
where C: RefUnwindSafe, <C as Crdt>::Delta: RefUnwindSafe,

§

impl<C> Send for LocalReplica<C>
where C: Send, <C as Crdt>::Delta: Send,

§

impl<C> Sync for LocalReplica<C>
where C: Sync, <C as Crdt>::Delta: Sync,

§

impl<C> Unpin for LocalReplica<C>
where C: Unpin, <C as Crdt>::Delta: Unpin,

§

impl<C> UnsafeUnpin for LocalReplica<C>
where C: UnsafeUnpin,

§

impl<C> UnwindSafe for LocalReplica<C>
where C: UnwindSafe, <C as Crdt>::Delta: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.