aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libstore/binary-cache-store.hh2
-rw-r--r--src/libstore/dummy-store.cc4
-rw-r--r--src/libstore/http-binary-cache-store.cc6
-rw-r--r--src/libstore/legacy-ssh-store.cc3
-rw-r--r--src/libstore/local-binary-cache-store.cc6
-rw-r--r--src/libstore/s3-binary-cache-store.cc3
-rw-r--r--src/libstore/ssh-store.cc6
-rw-r--r--src/libstore/store-api.cc3
-rw-r--r--src/libstore/store-api.hh16
9 files changed, 43 insertions, 6 deletions
diff --git a/src/libstore/binary-cache-store.hh b/src/libstore/binary-cache-store.hh
index 9bcdf5901..881398ea2 100644
--- a/src/libstore/binary-cache-store.hh
+++ b/src/libstore/binary-cache-store.hh
@@ -58,7 +58,7 @@ public:
public:
- virtual void init();
+ virtual void init() override;
private:
diff --git a/src/libstore/dummy-store.cc b/src/libstore/dummy-store.cc
index dd1880877..52086445e 100644
--- a/src/libstore/dummy-store.cc
+++ b/src/libstore/dummy-store.cc
@@ -5,6 +5,10 @@ namespace nix {
struct DummyStore : public Store
{
DummyStore(const std::string uri, const Params & params)
+ : DummyStore(params)
+ { }
+
+ DummyStore(const Params & params)
: Store(params)
{ }
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index c1abe35cb..e76bac6e2 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -24,6 +24,12 @@ private:
public:
HttpBinaryCacheStore(
+ const Params & params)
+ : HttpBinaryCacheStore("dummy", params)
+ {
+ }
+
+ HttpBinaryCacheStore(
const Path & _cacheUri,
const Params & params)
: BinaryCacheStore(params)
diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc
index 552b4b176..777ba7520 100644
--- a/src/libstore/legacy-ssh-store.cc
+++ b/src/libstore/legacy-ssh-store.cc
@@ -37,6 +37,9 @@ struct LegacySSHStore : public Store
static std::vector<std::string> uriPrefixes() { return {"ssh"}; }
+ LegacySSHStore(const Params & params)
+ : LegacySSHStore("dummy", params)
+ {}
LegacySSHStore(const string & host, const Params & params)
: Store(params)
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index 808a1338f..bcd23eb82 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -13,6 +13,12 @@ private:
public:
LocalBinaryCacheStore(
+ const Params & params)
+ : LocalBinaryCacheStore("dummy", params)
+ {
+ }
+
+ LocalBinaryCacheStore(
const Path & binaryCacheDir,
const Params & params)
: BinaryCacheStore(params)
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc
index f426b43a9..ab27f203f 100644
--- a/src/libstore/s3-binary-cache-store.cc
+++ b/src/libstore/s3-binary-cache-store.cc
@@ -192,6 +192,9 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
S3Helper s3Helper;
+ S3BinaryCacheStoreImpl(const Params & params)
+ : S3BinaryCacheStoreImpl("dummy-bucket", params) {}
+
S3BinaryCacheStoreImpl(
const std::string & bucketName,
const Params & params)
diff --git a/src/libstore/ssh-store.cc b/src/libstore/ssh-store.cc
index 8177a95b0..85ddce8be 100644
--- a/src/libstore/ssh-store.cc
+++ b/src/libstore/ssh-store.cc
@@ -17,6 +17,12 @@ public:
const Setting<Path> remoteProgram{(Store*) this, "nix-daemon", "remote-program", "path to the nix-daemon executable on the remote system"};
const Setting<std::string> remoteStore{(Store*) this, "", "remote-store", "URI of the store on the remote system"};
+ SSHStore(
+ const Params & params)
+ : SSHStore("dummy", params)
+ {
+ }
+
SSHStore(const std::string & host, const Params & params)
: Store(params)
, RemoteStore(params)
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 0f321b434..e14f361bd 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -1094,8 +1094,9 @@ ref<Store> openStore(const std::string & uri_,
}
for (auto implem : *Implementations::registered) {
- auto store = implem.open(uri, params);
+ auto store = implem.create(uri, params);
if (store) {
+ store->init();
store->warnUnknownSettings();
return ref<Store>(store);
}
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 61080978e..6e081da41 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -200,9 +200,12 @@ protected:
Store(const Params & params);
- std::shared_ptr<Config> getConfig();
-
public:
+ /**
+ * Perform any necessary effectful operation to make the store up and
+ * running
+ */
+ virtual void init() {};
virtual ~Store() { }
@@ -749,7 +752,8 @@ std::list<ref<Store>> getDefaultSubstituters();
struct StoreFactory
{
- std::function<std::shared_ptr<Store> (const std::string & uri, const Store::Params & params)> open;
+ std::function<std::shared_ptr<Store> (const std::string & uri, const Store::Params & params)> create;
+ std::function<std::shared_ptr<Store> (const Store::Params & params)> createDummy;
};
struct Implementations
{
@@ -760,10 +764,14 @@ struct Implementations
{
if (!registered) registered = new std::vector<StoreFactory>();
StoreFactory factory{
- .open =
+ .create =
([](const std::string & uri, const Store::Params & params)
-> std::shared_ptr<Store>
{ return std::make_shared<T>(uri, params); }),
+ .createDummy =
+ ([](const Store::Params & params)
+ -> std::shared_ptr<Store>
+ { return std::make_shared<T>(params); })
};
registered->push_back(factory);
}