Skip to main content
← dvs documentation Rust API reference

OperationObserver

Trait OperationObserver 

Source
pub trait OperationObserver: Send + Sync {
    // Provided methods
    fn planned(&self, _plan: &OperationPlan) { ... }
    fn hashing_started(&self) { ... }
    fn hashing_finished(&self) { ... }
    fn transfer_started(
        &self,
        _path: &Path,
        _total_bytes: u64,
    ) -> Option<FileProgress> { ... }
    fn file_finished(&self, _row: FileRow<'_>) { ... }
}
Expand description

Hooks an operation calls as it runs. Called from worker threads, possibly concurrently; implementations serialize their own output.

Provided Methods§

Source

fn planned(&self, _plan: &OperationPlan)

Once, after selection and storage checks, before any transfer.

Source

fn hashing_started(&self)

The first file that needs hashing is about to be hashed. Not called when nothing is hashed.

Source

fn hashing_finished(&self)

Hashing is done, once for every hashing_started, error exits included.

Source

fn transfer_started( &self, _path: &Path, _total_bytes: u64, ) -> Option<FileProgress>

A transfer of total_bytes for path is starting. The returned callbacks receive byte deltas and the transfer’s success; None means nobody is watching this transfer.

Source

fn file_finished(&self, _row: FileRow<'_>)

A file’s outcome is final, in completion order.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§