#include "store-api.hh" #include "callback.hh" namespace nix { struct DummyStoreConfig : virtual StoreConfig { using StoreConfig::StoreConfig; const std::string name() override { return "Dummy Store"; } std::string doc() override { return #include "dummy-store.md" ; } }; struct DummyStore : public virtual DummyStoreConfig, public virtual Store { DummyStore(const std::string scheme, const std::string uri, const Params & params) : DummyStore(params) { } DummyStore(const Params & params) : StoreConfig(params) , DummyStoreConfig(params) , Store(params) { } std::string getUri() override { return *uriSchemes().begin(); } void queryPathInfoUncached(const StorePath & path, Callback> callback) noexcept override { callback(nullptr); } /** * The dummy store is incapable of *not* trusting! :) */ virtual std::optional isTrustedClient() override { return Trusted; } static std::set uriSchemes() { return {"dummy"}; } std::optional queryPathFromHashPart(const std::string & hashPart) override { unsupported("queryPathFromHashPart"); } void addToStore(const ValidPathInfo & info, Source & source, RepairFlag repair, CheckSigsFlag checkSigs) override { unsupported("addToStore"); } void narFromPath(const StorePath & path, Sink & sink) override { unsupported("narFromPath"); } void queryRealisationUncached(const DrvOutput &, Callback> callback) noexcept override { callback(nullptr); } virtual ref getFSAccessor(bool requireValidPath) override { unsupported("getFSAccessor"); } }; static RegisterStoreImplementation regDummyStore; }