MetaStore

Trait MetaStore 

Source
pub trait MetaStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn save_hard_state(&self, state: &HardState) -> Result<(), Error>;
    fn load_hard_state(&self) -> Result<Option<HardState>, Error>;

    // Provided methods
    fn flush(&self) -> Result<(), Error> { ... }
    fn flush_async<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Metadata storage operations

Required Methods§

Source

fn save_hard_state(&self, state: &HardState) -> Result<(), Error>

Atomically persist hard state (current term and votedFor)

Source

fn load_hard_state(&self) -> Result<Option<HardState>, Error>

Load persisted hard state

Provided Methods§

Source

fn flush(&self) -> Result<(), Error>

Optional: Flush pending writes (use with caution)

Source

fn flush_async<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optional: Flush pending writes (use with caution)

Implementors§