-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure we can construct remote store configs in isolation #11108
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#include <regex> | ||
|
||
#include "ssh-store-config.hh" | ||
#include "common-ssh-store-config.hh" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ssh directory ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would wait for such things until we've fully switched to Meson -- the subdirectories we have today are not done in a consistent manner and mostly stuff is flat. |
||
#include "ssh.hh" | ||
|
||
namespace nix { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
#include "ssh-store-config.hh" | ||
#include "store-api.hh" | ||
#include "ssh-store.hh" | ||
#include "local-fs-store.hh" | ||
#include "remote-store.hh" | ||
#include "remote-store-connection.hh" | ||
#include "source-accessor.hh" | ||
#include "archive.hh" | ||
|
@@ -12,23 +10,22 @@ | |
|
||
namespace nix { | ||
|
||
struct SSHStoreConfig : virtual RemoteStoreConfig, virtual CommonSSHStoreConfig | ||
SSHStoreConfig::SSHStoreConfig( | ||
std::string_view scheme, | ||
std::string_view authority, | ||
const Params & params) | ||
: StoreConfig(params) | ||
, RemoteStoreConfig(params) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this validate it's ssh-ng ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh can't do that because its |
||
, CommonSSHStoreConfig(scheme, authority, params) | ||
{ | ||
using RemoteStoreConfig::RemoteStoreConfig; | ||
using CommonSSHStoreConfig::CommonSSHStoreConfig; | ||
|
||
const Setting<Strings> remoteProgram{this, {"nix-daemon"}, "remote-program", | ||
"Path to the `nix-daemon` executable on the remote machine."}; | ||
|
||
const std::string name() override { return "Experimental SSH Store"; } | ||
} | ||
|
||
std::string doc() override | ||
{ | ||
return | ||
#include "ssh-store.md" | ||
; | ||
} | ||
}; | ||
std::string SSHStoreConfig::doc() | ||
{ | ||
return | ||
#include "ssh-store.md" | ||
; | ||
} | ||
|
||
class SSHStore : public virtual SSHStoreConfig, public virtual RemoteStore | ||
{ | ||
|
@@ -41,7 +38,7 @@ class SSHStore : public virtual SSHStoreConfig, public virtual RemoteStore | |
: StoreConfig(params) | ||
, RemoteStoreConfig(params) | ||
, CommonSSHStoreConfig(scheme, host, params) | ||
, SSHStoreConfig(params) | ||
, SSHStoreConfig(scheme, host, params) | ||
, Store(params) | ||
, RemoteStore(params) | ||
, master(createSSHMaster( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
///@file | ||
|
||
#include "common-ssh-store-config.hh" | ||
#include "store-api.hh" | ||
#include "remote-store.hh" | ||
|
||
namespace nix { | ||
|
||
struct SSHStoreConfig : virtual RemoteStoreConfig, virtual CommonSSHStoreConfig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any comments here you can add? Should the legacy have \deprecated or @deprecated (whatever is the pattern in doxygen) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just moved this code. the legacy ssh uses a different protocol, but this one uses the same protocol as the Nix daemon. It probably shouldn't say "experimental" as its not an experimental feature (it predates those), but I think that's best done in a separate PR. |
||
{ | ||
using CommonSSHStoreConfig::CommonSSHStoreConfig; | ||
using RemoteStoreConfig::RemoteStoreConfig; | ||
|
||
SSHStoreConfig(std::string_view scheme, std::string_view authority, const Params & params); | ||
|
||
const Setting<Strings> remoteProgram{ | ||
this, {"nix-daemon"}, "remote-program", "Path to the `nix-daemon` executable on the remote machine."}; | ||
|
||
const std::string name() override | ||
{ | ||
return "Experimental SSH Store"; | ||
} | ||
|
||
std::string doc() override; | ||
}; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include "legacy-ssh-store.hh" | ||
|
||
namespace nix { | ||
|
||
TEST(LegacySSHStore, constructConfig) | ||
{ | ||
LegacySSHStoreConfig config{ | ||
"ssh", | ||
"localhost", | ||
StoreConfig::Params{ | ||
{ | ||
"remote-program", | ||
// TODO #11106, no more split on space | ||
"foo bar", | ||
}, | ||
}}; | ||
EXPECT_EQ( | ||
config.remoteProgram.get(), | ||
(Strings{ | ||
"foo", | ||
"bar", | ||
})); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include "ssh-store.hh" | ||
|
||
namespace nix { | ||
|
||
TEST(SSHStore, constructConfig) | ||
{ | ||
SSHStoreConfig config{ | ||
"ssh", | ||
"localhost", | ||
StoreConfig::Params{ | ||
{ | ||
"remote-program", | ||
// TODO #11106, no more split on space | ||
"foo bar", | ||
}, | ||
}}; | ||
EXPECT_EQ( | ||
config.remoteProgram.get(), | ||
(Strings{ | ||
"foo", | ||
"bar", | ||
})); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not apply formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't yet have a plan for how we want to format existing files (and this is a renamed file) --- e.g. creating conflicts with PRs, cherry-picks between us and Lix, etc. makes for some real downsides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already a clang-format; I find this take a bit odd.
Format and move on my take.