aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-binary-cache-store.cc
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2020-09-10 10:55:51 +0200
committerregnat <rg@regnat.ovh>2020-09-16 13:53:08 +0200
commit22afa8fb4dd7e459faf531dd8a9c3580d02c7e2a (patch)
tree00b6b6e1eaaccb3a190ce5d558298d8c9b013692 /src/libstore/local-binary-cache-store.cc
parentaa4eac37881258797c241113a5602913e1a5371a (diff)
Separate store configs from the implems
Rework the `Store` hierarchy so that there's now one hierarchy for the store configs and one for the implementations (where each implementation extends the corresponding config). So a class hierarchy like ``` StoreConfig-------->Store | | v v SubStoreConfig----->SubStore | | v v SubSubStoreConfig-->SubSubStore ``` (with virtual inheritance to prevent DDD). The advantage of this architecture is that we can now introspect the configuration of a store without having to instantiate the store itself
Diffstat (limited to 'src/libstore/local-binary-cache-store.cc')
-rw-r--r--src/libstore/local-binary-cache-store.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index bcd23eb82..fc3ae94c2 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -4,7 +4,12 @@
namespace nix {
-class LocalBinaryCacheStore : public BinaryCacheStore
+struct LocalBinaryCacheStoreConfig : virtual BinaryCacheStoreConfig
+{
+ using BinaryCacheStoreConfig::BinaryCacheStoreConfig;
+};
+
+class LocalBinaryCacheStore : public BinaryCacheStore, public virtual LocalBinaryCacheStoreConfig
{
private:
@@ -13,15 +18,10 @@ private:
public:
LocalBinaryCacheStore(
- const Params & params)
- : LocalBinaryCacheStore("dummy", params)
- {
- }
-
- LocalBinaryCacheStore(
const Path & binaryCacheDir,
const Params & params)
- : BinaryCacheStore(params)
+ : LocalBinaryCacheStoreConfig(params)
+ , BinaryCacheStore(params)
, binaryCacheDir(binaryCacheDir)
{
}
@@ -102,6 +102,6 @@ std::vector<std::string> LocalBinaryCacheStore::uriPrefixes()
return {"file"};
}
-static RegisterStoreImplementation<LocalBinaryCacheStore> regStore;
+static RegisterStoreImplementation<LocalBinaryCacheStore, LocalBinaryCacheStoreConfig> regStore;
}