Skip to main content

RemoteBackend

Trait RemoteBackend 

Source
pub trait RemoteBackend: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn download(
        &self,
        remote_key: &str,
        local_path: &Path,
    ) -> Result<bool, BackendError>;
    fn upload(
        &self,
        local_path: &Path,
        remote_key: &str,
    ) -> Result<(), BackendError>;
    fn exists(&self, remote_key: &str) -> Result<bool, BackendError>;
    fn delete(&self, remote_key: &str) -> Result<(), BackendError>;
    fn list(&self, prefix: &str) -> Result<Vec<String>, BackendError>;
}
Expand description

Trait for remote storage backends.

Implementations handle downloading and uploading database snapshots to/from remote storage. Operations are blocking (called during attach/reclaim lifecycle phases, not in hot query paths).

Required Methods§

Source

fn name(&self) -> &str

Human-readable name of this backend (e.g., “s3”, “r2”, “turso”, “d1”).

Source

fn download( &self, remote_key: &str, local_path: &Path, ) -> Result<bool, BackendError>

Download a remote object to a local file path. Returns Ok(true) if downloaded, Ok(false) if remote object doesn’t exist.

Source

fn upload( &self, local_path: &Path, remote_key: &str, ) -> Result<(), BackendError>

Upload a local file to remote storage.

Source

fn exists(&self, remote_key: &str) -> Result<bool, BackendError>

Check if a remote object exists.

Source

fn delete(&self, remote_key: &str) -> Result<(), BackendError>

Delete a remote object. Returns Ok(()) even if it didn’t exist.

Source

fn list(&self, prefix: &str) -> Result<Vec<String>, BackendError>

List remote objects matching a prefix.

Implementors§