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. TxOffset
s reported by
Durability::durable_tx_offset
shall be considered durable to the
extent the implementation can guarantee.
Required Associated Types§
Required Methods§
sourcefn append_tx(&self, tx: Self::TxData)
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.
sourcefn durable_tx_offset(&self) -> Option<TxOffset>
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.