Expand description
Common utilities and types for RCP file operation tools
This crate provides shared functionality used across all RCP tools (rcp, rrm, rlink, rcmp).
It includes core operations (copy, remove, link, compare), progress reporting, metadata preservation,
and runtime configuration.
§Core Modules
- copy- File copying operations with metadata preservation and error handling
- rm- File removal operations
- link- Hard-linking operations
- cmp- File comparison operations (metadata-based)
- preserve- Metadata preservation settings and operations
- progress- Progress tracking and reporting
- filecmp- File metadata comparison utilities
- remote_tracing- Remote tracing support for distributed operations
§Key Types
§RcpdType
Identifies the role of a remote copy daemon:
- Source- reads files from source host
- Destination- writes files to destination host
§ProgressType
Controls progress reporting display:
- Auto- automatically choose based on terminal type
- ProgressBar- animated progress bar (for interactive terminals)
- TextUpdates- periodic text updates (for logging/non-interactive)
§Progress Reporting
The crate provides a global progress tracking system accessible via get_progress().
Progress can be displayed in different formats depending on the execution context.
Progress output goes to stderr, while logs go to stdout, allowing users to redirect logs to a file while still viewing interactive progress.
§Runtime Configuration
The run function provides a unified entry point for all RCP tools with support for:
- Progress tracking and reporting
- Logging configuration (quiet/verbose modes)
- Resource limits (max workers, open files, throttling)
- Tokio runtime setup
- Remote tracing integration
§Examples
§Basic Copy Operation
use std::path::Path;
let src = Path::new("/source");
let dst = Path::new("/destination");
let settings = common::copy::Settings {
    dereference: false,
    fail_early: false,
    overwrite: false,
    overwrite_compare: Default::default(),
    chunk_size: 0,
};
let preserve = common::preserve::preserve_default();
let summary = common::copy(src, dst, &settings, &preserve).await?;
println!("Copied {} files", summary.files_copied);§Metadata Comparison
use std::path::Path;
let src = Path::new("/path1");
let dst = Path::new("/path2");
let log = common::cmp::LogWriter::new(None).await?;
let settings = common::cmp::Settings {
    fail_early: false,
    exit_early: false,
    compare: Default::default(),
};
let summary = common::cmp(src, dst, &log, &settings).await?;
println!("Comparison complete: {}", summary);Re-exports§
- pub use config::OutputConfig;
- pub use config::RuntimeConfig;
- pub use config::ThrottleConfig;
- pub use config::TracingConfig;
- pub use progress::RcpdProgressPrinter;
- pub use progress::SerializableProgress;
Modules§
- cmp
- config
- Configuration types for runtime and execution settings
- copy
- filecmp
- filegen
- link
- preserve
- progress
- remote_tracing 
- rm
Structs§
Enums§
Functions§
- cmp
- copy
- generate_debug_ log_ filename 
- get_progress 
- link
- parse_compare_ settings 
- parse_metadata_ cmp_ settings 
- parse_preserve_ settings 
- rm
- run