jepsen.control.scp
Built-in JDK SSH libraries can be orders of magnitude slower than plain old SCP for copying even medium-sized files of a few GB. This provides a faster implementation of a Remote which shells out to SCP.
exec!
(exec! remote ctx cmd-args)
A super basic exec implementation for our own purposes. At some point we might want to pull some? all? of control/exec all the way down into control.remote, and get rid of this.
remote
(remote cmd-remote)
Takes a remote which can execute commands, and wraps it in a remote which overrides upload & download to use SCP.
remote-path
(remote-path {:keys [username host]} path)
Returns the string representation of a remote path using a conn spec; e.g. admin@n1:/foo/bar
scp!
(scp! conn-spec sources dest)
Runs an SCP command by shelling out. Takes a conn-spec (used for port, key, etc), a seq of sources, and a single destination, all as strings.
tmp-dir
The remote directory we temporarily store files in while transferring up and down.
with-tmp-dir
macro
(with-tmp-dir remote ctx & body)
Evaluates body. If a nonzero exit status occurs, forces the tmp dir to exist, and re-evals body. We do this to avoid the overhead of checking for existence every time someone wants to upload/download a file.
with-tmp-file
macro
(with-tmp-file remote ctx [tmp-file-sym] & body)
Evaluates body with tmp-file-sym bound to the remote path of a temporary file. Cleans up file at exit.