Skip to main content

Crate rsynko_process

Crate rsynko_process 

Source
Expand description

§rsynko-process

rsynko-process runs the transfers rsynko-rsync states, as an operating-system process.

It decides nothing. The command, including every argument, is stated by rsynko-rsync; this crate spawns it, hands each line it writes back in order, and reports how it ended. What those lines mean is read by the specification, not here — this crate supplies SyncRunAlg and SyncWatchAlg and takes every other meaning from the in-memory interpretation of the transfer sorts.

Running one stated command
use rsynko_process::ProcessSyncEnv;
use rsynko_rsync::{RsyncEndpointExt, SyncCommandExt, SyncMode, SyncProgramExt};
use std::sync::mpsc::channel;

let (observations, watched) = channel();
let environment = ProcessSyncEnv::new(observations);
let command = environment.transfer_command(
    &environment.read_endpoint("backup@nas.local:/volume1/photos"),
    &environment.read_endpoint("/home/dev/photos"),
    SyncMode::rehearsal(),
);

let changes = environment.run_sync(&command)?;
println!("{} paths would change", changes.len());
while let Ok(observation) = watched.try_recv() {
    println!("{observation:?}");
}

A transfer writes its progress separated by carriage returns rather than newlines, so a line here ends at either one. The process is asked for its output only; whatever it wrote to its error stream is kept and stated as the reason a transfer failed.

Structs§

ProcessHold
Holds one running transfer still, and lets it go again.
ProcessSyncEnv
Runs folder transfers as operating-system processes.
SyncRun
Carries one running transfer process and the output it has not been read out of yet.

Enums§

ProcessSyncError
Denotes failure to run one folder transfer.

Constants§

HOLDING_IS_POSSIBLE
States whether a transfer can be held still on this machine at all.