Skip to main content

ScpWorker

Struct ScpWorker 

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

Worker that copies files to/from remote nodes via SCP.

Mirrors ClusterShell’s ScpClient / WorkerSsh copy mode.

Implementations§

Source§

impl ScpWorker

Source

pub fn new( nodes: Vec<String>, source: String, dest: String, fanout: usize, timeout: Option<Duration>, ssh_options: SshOptions, reverse: bool, preserve: bool, directory: bool, ) -> Self

Create a new ScpWorker for file copy.

§Arguments
  • nodes - Remote nodes to copy to/from.
  • source - Source file/directory path.
  • dest - Destination file/directory path.
  • fanout - Max concurrent SCP operations.
  • timeout - Optional per-node timeout.
  • ssh_options - SSH/SCP options.
  • reverse - If true, copy from remote to local.
  • preserve - If true, preserve file attributes.
  • directory - If true, copy recursively.
Source

pub fn source(&self) -> &str

Get the source path.

Source

pub fn dest(&self) -> &str

Get the destination path.

Source

pub fn is_reverse(&self) -> bool

Whether this is a reverse copy.

Trait Implementations§

Source§

impl Worker for ScpWorker

Source§

fn start(&mut self) -> Result<()>

Start the worker.
Source§

fn abort(&mut self, kill: bool)

Abort the worker, optionally killing child processes.
Source§

fn state(&self) -> WorkerState

Get the worker’s current state.
Source§

fn set_handler(&mut self, handler: Box<dyn EventHandler>)

Set the event handler for this worker.
Source§

fn read_fds(&self) -> Vec<RawFd> ⓘ

Get file descriptors for read interest.
Source§

fn write_fds(&self) -> Vec<RawFd> ⓘ

Get file descriptors for write interest.
Source§

fn handle_read(&mut self, fd: RawFd) -> Result<()>

Handle a read event on the given file descriptor.
Source§

fn handle_write(&mut self, fd: RawFd) -> Result<()>

Handle a write event on the given file descriptor.
Source§

fn is_done(&self) -> bool

Check if the worker has completed.
Source§

fn retcodes(&self) -> &HashMap<String, i32>

Get the return codes map: node -> return_code.
Source§

fn num_nodes(&self) -> usize

Get the number of nodes.
Source§

fn take_handler(&mut self) -> Option<Box<dyn EventHandler>>

Take the event handler out of the worker (used by Task to extract gathered data).

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.