pub trait DurableStorage<S: Lattice> {
// Required methods
fn persist(&mut self, state: &DurableState<S>) -> Result<(), StorageError>;
fn load(
&self,
replica_id: &str,
) -> Result<Option<DurableState<S>>, StorageError>;
fn sync(&mut self) -> Result<(), StorageError>;
}Expand description
Trait for durable storage backends
Implement this trait to persist DurableState across crashes.
Required Methods§
Sourcefn persist(&mut self, state: &DurableState<S>) -> Result<(), StorageError>
fn persist(&mut self, state: &DurableState<S>) -> Result<(), StorageError>
Persist the durable state
Sourcefn load(
&self,
replica_id: &str,
) -> Result<Option<DurableState<S>>, StorageError>
fn load( &self, replica_id: &str, ) -> Result<Option<DurableState<S>>, StorageError>
Load the durable state
Sourcefn sync(&mut self) -> Result<(), StorageError>
fn sync(&mut self) -> Result<(), StorageError>
Force sync to stable storage