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
impl SshWorker
Sourcepub fn new(
nodes: Vec<String>,
command: String,
fanout: usize,
timeout: Option<Duration>,
ssh_options: SshOptions,
) -> Self
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.
Sourcepub fn with_defaults(
nodes: Vec<String>,
command: String,
fanout: usize,
timeout: Option<Duration>,
) -> Self
pub fn with_defaults( nodes: Vec<String>, command: String, fanout: usize, timeout: Option<Duration>, ) -> Self
Create a new SshWorker with default SSH options.
Sourcepub fn with_stderr(self, stderr: bool) -> Self
pub fn with_stderr(self, stderr: bool) -> Self
Enable stderr capture.
Sourcepub fn ssh_options(&self) -> &SshOptions
pub fn ssh_options(&self) -> &SshOptions
Get the SSH options.
Sourcepub fn original_command(&self) -> &str
pub fn original_command(&self) -> &str
Get the original (unwrapped) command.
Trait Implementations§
Source§impl Worker for SshWorker
impl Worker for SshWorker
Source§fn state(&self) -> WorkerState
fn state(&self) -> WorkerState
Get the worker’s current state.
Source§fn set_handler(&mut self, handler: Box<dyn EventHandler>)
fn set_handler(&mut self, handler: Box<dyn EventHandler>)
Set the event handler for this worker.
Source§fn handle_read(&mut self, fd: RawFd) -> Result<()>
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<()>
fn handle_write(&mut self, fd: RawFd) -> Result<()>
Handle a write event on the given file descriptor.
Source§fn take_handler(&mut self) -> Option<Box<dyn EventHandler>>
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§
impl !RefUnwindSafe for SshWorker
impl !Sync for SshWorker
impl !UnwindSafe for SshWorker
impl Freeze for SshWorker
impl Send for SshWorker
impl Unpin for SshWorker
impl UnsafeUnpin for SshWorker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more