libstore: SSHMaster master -> SSH ssh
we no longer explicitly configure these ssh options, so we now have *even less* reason to stick to old and awful terminology. Change-Id: I8f38f5486e6918f69c61ddc2d6882b6bb50554c6
This commit is contained in:
@@ -56,7 +56,7 @@ struct LegacySSHStore final : public Store
|
||||
|
||||
struct Connection
|
||||
{
|
||||
std::unique_ptr<SSHMaster::Connection> sshConn;
|
||||
std::unique_ptr<SSH::Connection> sshConn;
|
||||
FdSink to;
|
||||
FdSource from;
|
||||
ServeProto::Version remoteVersion;
|
||||
@@ -98,7 +98,7 @@ struct LegacySSHStore final : public Store
|
||||
|
||||
ref<Pool<Connection>> connections;
|
||||
|
||||
SSHMaster master;
|
||||
SSH ssh;
|
||||
|
||||
static std::set<std::string> uriSchemes() { return {"ssh"}; }
|
||||
|
||||
@@ -113,7 +113,7 @@ struct LegacySSHStore final : public Store
|
||||
[this]() { return openConnection(); },
|
||||
[](const ref<Connection> & r) { return r->good; }
|
||||
))
|
||||
, master(
|
||||
, ssh(
|
||||
host,
|
||||
config_.port,
|
||||
config_.sshKey,
|
||||
@@ -126,7 +126,7 @@ struct LegacySSHStore final : public Store
|
||||
ref<Connection> openConnection()
|
||||
{
|
||||
auto conn = make_ref<Connection>();
|
||||
conn->sshConn = master.startCommand(
|
||||
conn->sshConn = ssh.startCommand(
|
||||
fmt("%s --serve --write", config_.remoteProgram)
|
||||
+ (config_.remoteStore.get() == ""
|
||||
? ""
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
, RemoteStore(config)
|
||||
, config_(std::move(config))
|
||||
, host(host)
|
||||
, master(
|
||||
, ssh(
|
||||
host,
|
||||
config_.port,
|
||||
config_.sshKey,
|
||||
@@ -68,7 +68,7 @@ protected:
|
||||
|
||||
struct Connection : RemoteStore::Connection
|
||||
{
|
||||
std::unique_ptr<SSHMaster::Connection> sshConn;
|
||||
std::unique_ptr<SSH::Connection> sshConn;
|
||||
|
||||
void closeWrite() override
|
||||
{
|
||||
@@ -80,7 +80,7 @@ protected:
|
||||
|
||||
std::string host;
|
||||
|
||||
SSHMaster master;
|
||||
SSH ssh;
|
||||
|
||||
void setOptions(RemoteStore::Connection & conn) override
|
||||
{
|
||||
@@ -101,7 +101,7 @@ ref<RemoteStore::Connection> SSHStore::openConnection()
|
||||
if (config_.remoteStore.get() != "")
|
||||
command += " --store " + shellEscape(config_.remoteStore.get());
|
||||
|
||||
conn->sshConn = master.startCommand(command);
|
||||
conn->sshConn = ssh.startCommand(command);
|
||||
conn->to = FdSink(conn->sshConn->in.get());
|
||||
conn->from = FdSource(conn->sshConn->out.get());
|
||||
return conn;
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace nix {
|
||||
|
||||
SSHMaster::SSHMaster(const std::string & host, const std::optional<uint16_t> port, const std::string & keyFile, const std::string & sshPublicHostKey, bool compress, int logFD)
|
||||
SSH::SSH(const std::string & host, const std::optional<uint16_t> port, const std::string & keyFile, const std::string & sshPublicHostKey, bool compress, int logFD)
|
||||
: host(host)
|
||||
, port(port)
|
||||
, fakeSSH(host == "localhost")
|
||||
@@ -24,7 +24,7 @@ SSHMaster::SSHMaster(const std::string & host, const std::optional<uint16_t> por
|
||||
state->tmpDir = std::make_unique<AutoDelete>(createTempDir("", "nix", true, true, 0700));
|
||||
}
|
||||
|
||||
void SSHMaster::addCommonSSHOpts(Strings & args)
|
||||
void SSH::addCommonSSHOpts(Strings & args)
|
||||
{
|
||||
auto state(state_.lock());
|
||||
|
||||
@@ -45,7 +45,7 @@ void SSHMaster::addCommonSSHOpts(Strings & args)
|
||||
args.push_back("-C");
|
||||
}
|
||||
|
||||
std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string & command)
|
||||
std::unique_ptr<SSH::Connection> SSH::startCommand(const std::string & command)
|
||||
{
|
||||
Pipe in, out;
|
||||
in.create();
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace nix {
|
||||
|
||||
class SSHMaster
|
||||
class SSH
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
SSHMaster(const std::string & host, const std::optional<uint16_t> port, const std::string & keyFile, const std::string & sshPublicHostKey, bool compress, int logFD = -1);
|
||||
SSH(const std::string & host, const std::optional<uint16_t> port, const std::string & keyFile, const std::string & sshPublicHostKey, bool compress, int logFD = -1);
|
||||
|
||||
struct Connection
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user