pub trait StateStore: Send + Sync {
// Required methods
fn save_checkpoint(&self, checkpoint: &Checkpoint) -> Result<(), StoreError>;
fn load_latest_checkpoint(&self) -> Result<Option<Checkpoint>, StoreError>;
fn load_checkpoint(&self, id: u64) -> Result<Option<Checkpoint>, StoreError>;
fn list_checkpoints(&self) -> Result<Vec<u64>, StoreError>;
fn prune_checkpoints(&self, keep: usize) -> Result<usize, StoreError>;
fn put(&self, key: &str, value: &[u8]) -> Result<(), StoreError>;
fn get(&self, key: &str) -> Result<Option<Vec<u8>>, StoreError>;
fn delete(&self, key: &str) -> Result<(), StoreError>;
fn flush(&self) -> Result<(), StoreError>;
}Expand description
Trait for state storage backends
Required Methods§
Sourcefn save_checkpoint(&self, checkpoint: &Checkpoint) -> Result<(), StoreError>
fn save_checkpoint(&self, checkpoint: &Checkpoint) -> Result<(), StoreError>
Store a checkpoint
Sourcefn load_latest_checkpoint(&self) -> Result<Option<Checkpoint>, StoreError>
fn load_latest_checkpoint(&self) -> Result<Option<Checkpoint>, StoreError>
Load the latest checkpoint
Sourcefn load_checkpoint(&self, id: u64) -> Result<Option<Checkpoint>, StoreError>
fn load_checkpoint(&self, id: u64) -> Result<Option<Checkpoint>, StoreError>
Load a specific checkpoint by ID
Sourcefn list_checkpoints(&self) -> Result<Vec<u64>, StoreError>
fn list_checkpoints(&self) -> Result<Vec<u64>, StoreError>
List all checkpoint IDs
Sourcefn prune_checkpoints(&self, keep: usize) -> Result<usize, StoreError>
fn prune_checkpoints(&self, keep: usize) -> Result<usize, StoreError>
Delete old checkpoints, keeping only the most recent N
Sourcefn put(&self, key: &str, value: &[u8]) -> Result<(), StoreError>
fn put(&self, key: &str, value: &[u8]) -> Result<(), StoreError>
Store arbitrary key-value data
Sourcefn get(&self, key: &str) -> Result<Option<Vec<u8>>, StoreError>
fn get(&self, key: &str) -> Result<Option<Vec<u8>>, StoreError>
Retrieve arbitrary key-value data
Sourcefn flush(&self) -> Result<(), StoreError>
fn flush(&self) -> Result<(), StoreError>
Flush all pending writes to disk