Skip to main content

SshWorker

Struct SshWorker 

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

Worker that executes commands on remote nodes via SSH.

SshWorker is a thin wrapper around ExecWorker that builds SSH commands using configurable SshOptions. It mirrors ClusterShell’s WorkerSsh class.

Implementations§

Source§

impl SshWorker

Source

pub fn new( nodes: Vec<String>, command: String, fanout: usize, timeout: Option<Duration>, ssh_options: SshOptions, ) -> Self

Create a new SshWorker.

§Arguments
  • nodes - List of remote node names to execute on.
  • command - Command to run on each remote node.
  • fanout - Max concurrent SSH connections.
  • timeout - Optional per-node timeout.
  • ssh_options - SSH connection options.
Source

pub fn with_defaults( nodes: Vec<String>, command: String, fanout: usize, timeout: Option<Duration>, ) -> Self

Create a new SshWorker with default SSH options.

Source

pub fn with_stderr(self, stderr: bool) -> Self

Enable stderr capture.

Source

pub fn ssh_options(&self) -> &SshOptions

Get the SSH options.

Source

pub fn original_command(&self) -> &str

Get the original (unwrapped) command.

Trait Implementations§

Source§

impl Worker for SshWorker

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.