1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 02:11:15 +02:00

Create CommonSSHStoreConfig::createSSHMaster

By moving `host` to the config, we can do a lot further cleanups and
dedups. This anticipates a world where we always go `StoreReference` ->
`*StoreConfig` -> `Store*` rather than skipping the middle step too.

Progress on #10766

Progress on https://github.com/NixOS/hydra/issues/1164
This commit is contained in:
John Ericson 2024-05-23 12:14:53 -04:00
parent 17964441d9
commit 3e9c3738d3
7 changed files with 61 additions and 58 deletions

View file

@ -32,32 +32,19 @@ LegacySSHStore::LegacySSHStore(
std::string_view scheme,
std::string_view host,
const Params & params)
: LegacySSHStore{scheme, LegacySSHStoreConfig::extractConnStr(scheme, host), params}
{
}
LegacySSHStore::LegacySSHStore(
std::string_view scheme,
std::string host,
const Params & params)
: StoreConfig(params)
, CommonSSHStoreConfig(params)
, CommonSSHStoreConfig(scheme, host, params)
, LegacySSHStoreConfig(params)
, Store(params)
, host(host)
, connections(make_ref<Pool<Connection>>(
std::max(1, (int) maxConnections),
[this]() { return openConnection(); },
[](const ref<Connection> & r) { return r->good; }
))
, master(
host,
sshKey.get(),
sshPublicHostKey.get(),
, master(createSSHMaster(
// Use SSH master only if using more than 1 connection.
connections->capacity() > 1,
compress,
logFD)
logFD))
{
}