Skip to main content

ControllerStore

Trait ControllerStore 

Source
pub trait ControllerStore: Send + Sync {
    // Required methods
    fn load(&self) -> Result<Option<Vec<u8>>, StoreError>;
    fn save(&self, snapshot: &[u8]) -> Result<(), StoreError>;
}
Expand description

A durable home for the controller’s snapshot blob.

The controller owns the blob format (a versioned TLV encoding); the store only moves opaque bytes. Implementors are responsible for at-rest protection — the snapshot contains private keys in the clear.

Required Methods§

Source

fn load(&self) -> Result<Option<Vec<u8>>, StoreError>

Load the persisted snapshot, or None if nothing has been stored yet.

§Errors

Returns StoreError if the backing store cannot be read.

Source

fn save(&self, snapshot: &[u8]) -> Result<(), StoreError>

Atomically replace the persisted snapshot.

§Errors

Returns StoreError if the backing store cannot be written.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§