Trait spacetimedb_durability::History

source ·
pub trait History {
    type TxData;

    // Required methods
    fn fold_transactions_from<D>(
        &self,
        offset: TxOffset,
        decoder: D
    ) -> Result<(), D::Error>
       where D: Decoder,
             D::Error: From<Traversal>;
    fn transactions_from<'a, D>(
        &self,
        offset: TxOffset,
        decoder: &'a D
    ) -> impl Iterator<Item = Result<Transaction<Self::TxData>, D::Error>>
       where D: Decoder<Record = Self::TxData>,
             D::Error: From<Traversal>,
             Self::TxData: 'a;
}
Expand description

Access to the durable history.

The durable history is the sequence of transactions in the order Durability::append_tx was called.

Some Durability implementations will be able to also implement this trait, but others may not. A database may also use a Durability implementation to persist transactions, but a separate History implementation to obtain the history.

Required Associated Types§

Required Methods§

source

fn fold_transactions_from<D>( &self, offset: TxOffset, decoder: D ) -> Result<(), D::Error>
where D: Decoder, D::Error: From<Traversal>,

Traverse the history of transactions from offset and “fold” it into the provided Decoder.

source

fn transactions_from<'a, D>( &self, offset: TxOffset, decoder: &'a D ) -> impl Iterator<Item = Result<Transaction<Self::TxData>, D::Error>>
where D: Decoder<Record = Self::TxData>, D::Error: From<Traversal>, Self::TxData: 'a,

Obtain an iterator over the history of transactions, starting from offset.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: History> History for Arc<T>

§

type TxData = <T as History>::TxData

source§

fn fold_transactions_from<D>( &self, offset: TxOffset, decoder: D ) -> Result<(), D::Error>
where D: Decoder, D::Error: From<Traversal>,

source§

fn transactions_from<'a, D>( &self, offset: TxOffset, decoder: &'a D ) -> impl Iterator<Item = Result<Transaction<Self::TxData>, D::Error>>
where D: Decoder<Record = Self::TxData>, D::Error: From<Traversal>, Self::TxData: 'a,

Implementors§

source§

impl<T: Encode + 'static> History for Local<T>

§

type TxData = Txdata<T>