Skip to main content

RcloneBackend

Struct RcloneBackend 

Source
pub struct RcloneBackend { /* private fields */ }
Expand description

Rclone CLI storage backend.

Uses inline credentials via :backend,key=val:bucket/path syntax to avoid requiring global rclone config files.

The remote string is wrapped in SecretBox to prevent accidental logging of embedded credentials.

Commands are executed via a RemoteShell, defaulting to [LocalShell].

§Timeout configuration

Resolution order: explicit (with_timeout) > env (VDSL_RCLONE_TIMEOUT) > default (300s). Batch operations scale the timeout by file count.

Implementations§

Source§

impl RcloneBackend

Source

pub fn new(remote: impl Into<String>) -> Self

Create a new RcloneBackend with the given remote string.

Timeout: env VDSL_RCLONE_TIMEOUT or default 300s. Uses [LocalShell] for command execution (backward compatible).

§Example
let backend = RcloneBackend::new(":b2,account=key_id,key=secret:my-bucket");
Source

pub fn with_shell( remote: impl Into<String>, shell: Box<dyn RemoteShell>, ) -> Self

Create with a custom RemoteShell (e.g. PodShell for GPU pod execution).

Source

pub fn with_timeout(self, timeout_secs: u64) -> Self

Set an explicit timeout (seconds), overriding env and default.

Useful when constructing from parsed config values. Floor: 10 seconds.

Trait Implementations§

Source§

impl StorageBackend for RcloneBackend

Source§

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,

Note: returns Ok(false) on any rclone error (including network failures). This is a best-effort check — callers must not rely on false meaning “confirmed absent”. Use push/pull for authoritative operations.

Source§

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,

Batch push using rclone copy --files-from.

For SFTP remotes, splits into chunks of [SFTP_BATCH_CHUNK_SIZE] files with per-chunk progress logging and retry. Non-SFTP backends run as a single batch (rclone handles large batches natively for B2/S3).

Returns per-file Ok/Err.

Source§

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,

Batch pull using rclone copy --files-from.

For SFTP remotes, splits into chunks with progress logging and retry.

Source§

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,

Batch delete using rclone delete --files-from.

For SFTP remotes, splits into chunks with progress logging and retry.

Source§

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.
Source§

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.
Source§

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.
Source§

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. Read more
Source§

fn supports_batch(&self) -> bool

Whether this backend supports efficient batch push/pull. Read more
Source§

fn backend_type(&self) -> &str

Backend type name for display and config matching.
Source§

fn set_progress_callback(&self, callback: Option<ProgressFn>)

Set a progress callback for batch operations. Read more
Source§

fn ensure<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), InfraError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

外部ツールの到達確認 + 確保。 Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more