Trait bdk_persist::PersistBackend

source ·
pub trait PersistBackend<C> {
    // Required methods
    fn write_changes(&mut self, changeset: &C) -> Result<()>;
    fn load_from_persistence(&mut self) -> Result<Option<C>>;
}
Expand description

A persistence backend for Persist.

C represents the changeset; a datatype that records changes made to in-memory data structures that are to be persisted, or retrieved from persistence.

Required Methods§

source

fn write_changes(&mut self, changeset: &C) -> Result<()>

Writes a changeset to the persistence backend.

It is up to the backend what it does with this. It could store every changeset in a list or it inserts the actual changes into a more structured database. All it needs to guarantee is that load_from_persistence restores a keychain tracker to what it should be if all changesets had been applied sequentially.

source

fn load_from_persistence(&mut self) -> Result<Option<C>>

Return the aggregate changeset C from persistence.

Implementations on Foreign Types§

source§

impl<C> PersistBackend<C> for ()

source§

fn write_changes(&mut self, _changeset: &C) -> Result<()>

source§

fn load_from_persistence(&mut self) -> Result<Option<C>>

Implementors§