Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: Send + Sync {
    // Required methods
    fn write(&self, session_id: &Uuid, data: &[u8]) -> Result<()>;
    fn read(&self, session_id: &Uuid) -> Result<Option<Vec<u8>>>;
    fn write_named(&self, name: &str, data: &[u8]) -> Result<()>;
    fn read_named(&self, name: &str) -> Result<Option<Vec<u8>>>;
    fn delete(&self, session_id: &Uuid) -> Result<()>;
}
Expand description

Backend abstraction for raw byte reads and atomic writes.

Required Methods§

Source

fn write(&self, session_id: &Uuid, data: &[u8]) -> Result<()>

Atomically write data to the file for session_id.

Source

fn read(&self, session_id: &Uuid) -> Result<Option<Vec<u8>>>

Read the raw bytes for session_id. Returns None if no file exists.

Source

fn write_named(&self, name: &str, data: &[u8]) -> Result<()>

Write data under a fixed domain name (e.g. “manifest”).

Source

fn read_named(&self, name: &str) -> Result<Option<Vec<u8>>>

Read data from a fixed domain name. Returns None if not found.

Source

fn delete(&self, session_id: &Uuid) -> Result<()>

Delete the file for session_id.

Implementors§