Trait spacetimedb_durability::Durability

source ·
pub trait Durability: Send + Sync {
    type TxData;

    // Required methods
    fn append_tx(&self, tx: Self::TxData);
    fn durable_tx_offset(&self) -> Option<TxOffset>;
}
Expand description

The durability API.

NOTE: This is a preliminary definition, still under consideration.

A durability implementation accepts a payload representing a single database transaction via Durability::append_tx in a non-blocking fashion. The payload should become durable eventually. TxOffsets reported by Durability::durable_tx_offset shall be considered durable to the extent the implementation can guarantee.

Required Associated Types§

source

type TxData

The payload representing a single transaction.

Required Methods§

source

fn append_tx(&self, tx: Self::TxData)

Submit the transaction payload to be made durable.

This method must never block, and accept new transactions even if they cannot be made durable immediately.

A permanent failure of the durable storage may be signalled by panicking.

source

fn durable_tx_offset(&self) -> Option<TxOffset>

The TxOffset considered durable.

A None return value indicates that the durable offset is not known, either because nothing has been persisted yet, or because the status cannot be retrieved.

Implementors§

source§

impl<T: Send + Sync + 'static> Durability for Local<T>

§

type TxData = Txdata<T>