pub trait StorageBackend: Send + Sync {
// Required methods
fn push<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
local_path: &'life1 Path,
remote_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn pull<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
local_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RemoteFile>, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, InfraError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn backend_type(&self) -> &str;
// Provided methods
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn push_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
src_root: &'life1 Path,
dest_root: &'life2 str,
relative_paths: &'life3 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn pull_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
src_root: &'life1 str,
dest_root: &'life2 Path,
relative_paths: &'life3 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn delete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
remote_root: &'life1 str,
relative_paths: &'life2 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn supports_batch(&self) -> bool { ... }
fn set_progress_callback(&self, _callback: Option<ProgressFn>) { ... }
fn ensure<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Abstract file transfer backend.
Implementations handle the actual data movement for a specific protocol. The sync service routes operations to the correct backend based on location.
Required Methods§
Sourcefn push<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
local_path: &'life1 Path,
remote_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn push<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
local_path: &'life1 Path,
remote_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Push a local file to this remote.
Sourcefn pull<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
local_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn pull<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
local_path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Pull a file from this remote to a local path.
Sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RemoteFile>, InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RemoteFile>, InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List files at a remote path.
Sourcefn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a remote file exists.
Sourcefn backend_type(&self) -> &str
fn backend_type(&self) -> &str
Backend type name for display and config matching.
Provided Methods§
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
remote_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a file on this remote.
Returns Ok(()) if the file was deleted or didn’t exist.
Default implementation returns Err — backends that support deletion
must override this.
Sourcefn push_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
src_root: &'life1 Path,
dest_root: &'life2 str,
relative_paths: &'life3 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn push_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
src_root: &'life1 Path,
dest_root: &'life2 str,
relative_paths: &'life3 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Push multiple files in a single batch operation.
src_root is the local base directory, dest_root is the remote base,
and relative_paths are paths relative to both roots.
Returns a map of relative_path → Ok/Err for per-file status tracking.
Default implementation falls back to sequential push() calls.
Sourcefn pull_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
src_root: &'life1 str,
dest_root: &'life2 Path,
relative_paths: &'life3 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn pull_batch<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
src_root: &'life1 str,
dest_root: &'life2 Path,
relative_paths: &'life3 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Pull multiple files in a single batch operation.
src_root is the remote base, dest_root is the local base directory,
and relative_paths are paths relative to both roots.
Returns a map of relative_path → Ok/Err for per-file status tracking.
Default implementation falls back to sequential pull() calls.
Sourcefn delete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
remote_root: &'life1 str,
relative_paths: &'life2 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
remote_root: &'life1 str,
relative_paths: &'life2 [String],
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<(), InfraError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete multiple files in a single batch operation.
remote_root is the remote base directory, relative_paths are paths
relative to it. Uses rclone delete --files-from for rclone backends.
Returns a map of relative_path → Ok/Err for per-file status tracking.
Default implementation falls back to sequential delete() calls.
Sourcefn supports_batch(&self) -> bool
fn supports_batch(&self) -> bool
Whether this backend supports efficient batch push/pull.
When true, callers should prefer push_batch/pull_batch/delete_batch
over individual calls. Default: false (sequential fallback).
Sourcefn set_progress_callback(&self, _callback: Option<ProgressFn>)
fn set_progress_callback(&self, _callback: Option<ProgressFn>)
Set a progress callback for batch operations.
Called by the sync engine before batch execution. Implementations that support chunked transfers (e.g. RcloneBackend) should call this callback on chunk completion. Default: no-op (callback is ignored).