Skip to main content

SyncStorageBackend

Trait SyncStorageBackend 

Source
pub trait SyncStorageBackend: Send + Sync {
    // Required methods
    fn save(&self, snapshot: &Snapshot) -> Result<String, StorageError>;
    fn save_decision(
        &self,
        decision: &DecisionSnapshot,
    ) -> Result<String, StorageError>;
    fn load(&self, snapshot_id: &str) -> Result<Snapshot, StorageError>;
    fn load_decision(
        &self,
        decision_id: &str,
    ) -> Result<DecisionSnapshot, StorageError>;
    fn query(&self, query: SnapshotQuery) -> Result<Vec<Snapshot>, StorageError>;
    fn delete(&self, snapshot_id: &str) -> Result<bool, StorageError>;
    fn flush(&self) -> Result<FlushResult, StorageError>;
    fn health_check(&self) -> Result<bool, StorageError>;
}
Expand description

Synchronous storage backend trait

Required Methods§

Source

fn save(&self, snapshot: &Snapshot) -> Result<String, StorageError>

Save a snapshot, return its ID

Source

fn save_decision( &self, decision: &DecisionSnapshot, ) -> Result<String, StorageError>

Save a single decision snapshot

Source

fn load(&self, snapshot_id: &str) -> Result<Snapshot, StorageError>

Load a snapshot by ID

Source

fn load_decision( &self, decision_id: &str, ) -> Result<DecisionSnapshot, StorageError>

Load a decision by ID

Source

fn query(&self, query: SnapshotQuery) -> Result<Vec<Snapshot>, StorageError>

Query snapshots with filters

Source

fn delete(&self, snapshot_id: &str) -> Result<bool, StorageError>

Delete a snapshot

Source

fn flush(&self) -> Result<FlushResult, StorageError>

Flush pending writes (for batching backends)

Source

fn health_check(&self) -> Result<bool, StorageError>

Check health/connectivity

Implementors§

Source§

impl SyncStorageBackend for MemoryStorageBackend

Source§

impl SyncStorageBackend for SyncSqliteBackend

Available on crate feature sqlite-storage only.