aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/dummy-store.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-23 22:35:41 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-23 22:35:41 +0000
commit45ca7c3e4b92bbafbfa8e30513c9dd3cfe76e3f1 (patch)
tree687ae85bfed1558f05880dfdb8bc358520134c52 /src/libstore/dummy-store.cc
parente61061c88e0dfcce9329ea9f0b041a35270dfa1a (diff)
parent8d9402f411643c451cf2a0776afcb3a1af0f9a8c (diff)
Merge remote-tracking branch 'upstream/master' into path-info
Diffstat (limited to 'src/libstore/dummy-store.cc')
-rw-r--r--src/libstore/dummy-store.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/libstore/dummy-store.cc b/src/libstore/dummy-store.cc
new file mode 100644
index 000000000..49641c2ac
--- /dev/null
+++ b/src/libstore/dummy-store.cc
@@ -0,0 +1,68 @@
+#include "store-api.hh"
+#include "callback.hh"
+
+namespace nix {
+
+struct DummyStoreConfig : virtual StoreConfig {
+ using StoreConfig::StoreConfig;
+
+ const std::string name() override { return "Dummy Store"; }
+};
+
+struct DummyStore : public Store, public virtual DummyStoreConfig
+{
+ DummyStore(const std::string scheme, const std::string uri, const Params & params)
+ : DummyStore(params)
+ { }
+
+ DummyStore(const Params & params)
+ : StoreConfig(params)
+ , Store(params)
+ {
+ }
+
+ string getUri() override
+ {
+ return *uriSchemes().begin();
+ }
+
+ void queryPathInfoUncached(const StorePath & path,
+ Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept override
+ {
+ callback(nullptr);
+ }
+
+ static std::set<std::string> uriSchemes() {
+ return {"dummy"};
+ }
+
+ std::optional<StorePath> queryPathFromHashPart(const std::string & hashPart) override
+ { unsupported("queryPathFromHashPart"); }
+
+ void addToStore(const ValidPathInfo & info, Source & source,
+ RepairFlag repair, CheckSigsFlag checkSigs) override
+ { unsupported("addToStore"); }
+
+ StorePath addToStore(const string & name, const Path & srcPath,
+ FileIngestionMethod method, HashType hashAlgo,
+ PathFilter & filter, RepairFlag repair) override
+ { unsupported("addToStore"); }
+
+ StorePath addTextToStore(const string & name, const string & s,
+ const StorePathSet & references, RepairFlag repair) override
+ { unsupported("addTextToStore"); }
+
+ void narFromPath(const StorePath & path, Sink & sink) override
+ { unsupported("narFromPath"); }
+
+ void ensurePath(const StorePath & path) override
+ { unsupported("ensurePath"); }
+
+ BuildResult buildDerivation(const StorePath & drvPath, const BasicDerivation & drv,
+ BuildMode buildMode) override
+ { unsupported("buildDerivation"); }
+};
+
+static RegisterStoreImplementation<DummyStore, DummyStoreConfig> regStore;
+
+}