aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/dummy-store.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-04 02:40:36 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-04 02:40:36 +0000
commit25f7ff16fa47a6143a129fb56c9a4ecdb2259a8d (patch)
tree03764f681fddc94e532dc7a74608f37a0a698cd2 /src/libstore/dummy-store.cc
parente12bcabdcbddc228d7af157bb3c2090e324c59a7 (diff)
parent8a945d6ddb0676b454458e6fe0e9ea6f8b4b5659 (diff)
Merge remote-tracking branch 'upstream/master' into fix-and-ci-static-builds
Diffstat (limited to 'src/libstore/dummy-store.cc')
-rw-r--r--src/libstore/dummy-store.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/libstore/dummy-store.cc b/src/libstore/dummy-store.cc
new file mode 100644
index 000000000..7a5744bc1
--- /dev/null
+++ b/src/libstore/dummy-store.cc
@@ -0,0 +1,59 @@
+#include "store-api.hh"
+
+namespace nix {
+
+static std::string uriScheme = "dummy://";
+
+struct DummyStore : public Store
+{
+ DummyStore(const Params & params)
+ : Store(params)
+ { }
+
+ string getUri() override
+ {
+ return uriScheme;
+ }
+
+ void queryPathInfoUncached(const StorePath & path,
+ Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept override
+ {
+ callback(nullptr);
+ }
+
+ 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 regStore([](
+ const std::string & uri, const Store::Params & params)
+ -> std::shared_ptr<Store>
+{
+ if (uri != uriScheme) return nullptr;
+ return std::make_shared<DummyStore>(params);
+});
+
+}