pub trait StorageBackend: Send + Sync {
// Required methods
fn put(&self, key: &str, data: &[u8]) -> Result<()>;
fn get(&self, key: &str) -> Result<Vec<u8>>;
fn delete(&self, key: &str) -> Result<()>;
fn exists(&self, key: &str) -> Result<bool>;
fn list(&self, prefix: &str) -> Result<Vec<ObjectMetadata>>;
fn sync(&self) -> Result<()>;
fn base_path(&self) -> Option<&Path>;
}Expand description
Storage backend trait
Abstracts storage operations to support multiple backends:
- LocalFsBackend: Local filesystem (default)
- S3Backend: AWS S3 (planned)
- GcsBackend: Google Cloud Storage (planned)
- AzureBlobBackend: Azure Blob Storage (planned)
Usage:
ⓘ
let backend = LocalFsBackend::new("/data")?;
backend.put("wal.log", &data)?;
let data = backend.get("wal.log")?;Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".