Skip to main content

DurableReplica

Struct DurableReplica 

Source
pub struct DurableReplica<C: Crdt> { /* private fields */ }
Expand description

Additive durable API for Linux local filesystems. The root must already exist durably and remain in place; all writers use the same fixed root and configuration. Each Accepted/Ok(record) follows full transaction replacement and file + directory sync. Any persistence error permanently disables this instance’s writes, retaining its fence until drop. Use the explicit restart constructors for existing stores; fresh constructors never reset a store.

Implementations§

Source§

impl<C: Crdt> DurableReplica<C>
where C::Delta: OwnedDelta + Clone + PartialEq + WireEncode + WireSchema,

Source

pub fn state(&self) -> &C

Source

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

Source

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

Source

pub fn ticket(&self) -> WriteTicket

Source

pub fn renew(&mut self, ticket: WriteTicket) -> Result<WriteTicket, LocalError>

Source

pub fn receive( &mut self, ticket: WriteTicket, record: Record<C::Delta>, ) -> Result<Admission, LocalError>

Source

pub fn append( &mut self, ticket: WriteTicket, delta: C::Delta, ) -> Result<Record<C::Delta>, LocalError>

Source§

impl DurableReplica<GCounter>

Source

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

Reacquire ownership, validate the committed history and replay fresh state. Any error returns no replica and grants no write ticket.

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 DurableReplica<OrSet<String, u64>>

Source

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

Checked ordinary restart, including tombstones and token allocation.

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>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<C> UnwindSafe for DurableReplica<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.