![]() |
SMT-RAT
24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
|
A wrapper class that manages a single SSH connection as specified in a Node object (with all its channels). More...
#include <SSHConnection.h>
Public Member Functions | |
SSHConnection (const Node &n) | |
Create a new connection for the given node. More... | |
~SSHConnection () | |
Wait for all channels to terminate. More... | |
const Node & | getNode () const |
Return the node. More... | |
bool | jobFree () |
Check if a new job could be started. More... | |
void | newJob () |
Increase job counter. More... | |
void | finishJob () |
Decrease job counter. More... | |
std::size_t | jobs () const |
Current number of jobs. More... | |
bool | busy () |
Check if all channels are busy. More... | |
std::string | createTmpDir (const std::string &folder) |
Create a temporary directory on the remote. More... | |
void | removeDir (const std::string &folder) |
Remove a (temporary) directory on the remote. More... | |
bool | uploadFile (const fs::path &local, const std::string &base, const std::string &remote, int mode=S_IRUSR|S_IWUSR) |
Upload a file to the remote. More... | |
bool | executeCommand (const std::string &cmd, BenchmarkResult &result) |
Execute a command on the remote. More... | |
Private Member Functions | |
std::chrono::milliseconds | parse_duration (const std::string &output) const |
Parse a duration from stdout. More... | |
ssh_channel | getChannel () |
Allocate a new channel from the current SSH session. More... | |
ssh_scp | getSCP (int mode, const std::string &basedir) |
Get a new SCP session for file transfer. More... | |
sftp_session | getSFTP () |
Get a new SFTP session for file transfer. More... | |
void | destroy (ssh_channel channel) |
Terminate a SSH channel. More... | |
void | destroy (ssh_scp scp) |
Terminate a SCP session. More... | |
void | destroy (sftp_session sftp) |
Terminate a SFTP session. More... | |
Private Attributes | |
Node | node |
The node object. More... | |
std::size_t | curChannels |
The number of currently active channels. More... | |
std::size_t | maxChannels |
The maximal number of channels allowed. More... | |
std::atomic< std::size_t > | curJobs |
The number of currently running jobs. More... | |
ssh_session | session |
The SSH session handle. More... | |
std::mutex | mutex |
Mutex. More... | |
int | verbosity |
Verbosity needed due to libssh interface. More... | |
A wrapper class that manages a single SSH connection as specified in a Node object (with all its channels).
Definition at line 21 of file SSHConnection.h.
|
inline |
Create a new connection for the given node.
Definition at line 136 of file SSHConnection.h.
|
inline |
Wait for all channels to terminate.
Definition at line 165 of file SSHConnection.h.
|
inline |
Check if all channels are busy.
Definition at line 194 of file SSHConnection.h.
|
inline |
Create a temporary directory on the remote.
Definition at line 200 of file SSHConnection.h.
|
inlineprivate |
Terminate a SFTP session.
Definition at line 128 of file SSHConnection.h.
|
inlineprivate |
Terminate a SSH channel.
Definition at line 110 of file SSHConnection.h.
|
inlineprivate |
Terminate a SCP session.
Definition at line 119 of file SSHConnection.h.
|
inline |
Execute a command on the remote.
Definition at line 273 of file SSHConnection.h.
|
inline |
Decrease job counter.
Definition at line 186 of file SSHConnection.h.
|
inlineprivate |
Allocate a new channel from the current SSH session.
Definition at line 53 of file SSHConnection.h.
|
inline |
Return the node.
Definition at line 173 of file SSHConnection.h.
|
inlineprivate |
Get a new SCP session for file transfer.
Definition at line 72 of file SSHConnection.h.
|
inlineprivate |
Get a new SFTP session for file transfer.
Definition at line 91 of file SSHConnection.h.
|
inline |
Check if a new job could be started.
Definition at line 177 of file SSHConnection.h.
|
inline |
Current number of jobs.
Definition at line 190 of file SSHConnection.h.
|
inline |
Increase job counter.
Definition at line 181 of file SSHConnection.h.
|
inlineprivate |
Parse a duration from stdout.
Definition at line 39 of file SSHConnection.h.
|
inline |
Remove a (temporary) directory on the remote.
Definition at line 214 of file SSHConnection.h.
|
inline |
Upload a file to the remote.
Definition at line 250 of file SSHConnection.h.
|
private |
The number of currently active channels.
Definition at line 26 of file SSHConnection.h.
|
private |
The number of currently running jobs.
Definition at line 30 of file SSHConnection.h.
|
private |
The maximal number of channels allowed.
Definition at line 28 of file SSHConnection.h.
|
private |
Mutex.
Definition at line 34 of file SSHConnection.h.
|
private |
The node object.
Definition at line 24 of file SSHConnection.h.
|
private |
The SSH session handle.
Definition at line 32 of file SSHConnection.h.
|
private |
Verbosity needed due to libssh interface.
Definition at line 36 of file SSHConnection.h.