2020-08-24 16:54:16 +00:00
|
|
|
#include "store-api.hh"
|
2020-09-21 16:40:11 +00:00
|
|
|
#include "callback.hh"
|
2020-08-24 16:54:16 +00:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2020-09-14 09:18:45 +00:00
|
|
|
struct DummyStoreConfig : virtual StoreConfig {
|
2020-09-11 09:06:18 +00:00
|
|
|
using StoreConfig::StoreConfig;
|
2020-09-14 12:04:02 +00:00
|
|
|
|
|
|
|
const std::string name() override { return "Dummy Store"; }
|
2020-09-11 09:06:18 +00:00
|
|
|
};
|
2020-09-10 08:55:51 +00:00
|
|
|
|
2020-09-11 09:06:18 +00:00
|
|
|
struct DummyStore : public Store, public virtual DummyStoreConfig
|
2020-08-24 16:54:16 +00:00
|
|
|
{
|
2020-09-11 09:11:05 +00:00
|
|
|
DummyStore(const std::string scheme, const std::string uri, const Params & params)
|
2020-09-09 09:29:17 +00:00
|
|
|
: DummyStore(params)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
DummyStore(const Params & params)
|
2020-09-11 09:06:18 +00:00
|
|
|
: StoreConfig(params)
|
|
|
|
, Store(params)
|
2020-10-06 12:00:42 +00:00
|
|
|
{ }
|
2020-08-24 16:54:16 +00:00
|
|
|
|
|
|
|
string getUri() override
|
|
|
|
{
|
2020-09-11 09:11:05 +00:00
|
|
|
return *uriSchemes().begin();
|
2020-08-24 16:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void queryPathInfoUncached(const StorePath & path,
|
|
|
|
Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept override
|
|
|
|
{
|
|
|
|
callback(nullptr);
|
|
|
|
}
|
|
|
|
|
2020-09-11 09:11:05 +00:00
|
|
|
static std::set<std::string> uriSchemes() {
|
2020-09-08 12:50:23 +00:00
|
|
|
return {"dummy"};
|
|
|
|
}
|
|
|
|
|
2020-08-24 16:54:16 +00:00
|
|
|
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"); }
|
2020-10-08 15:36:51 +00:00
|
|
|
|
|
|
|
std::optional<const Realisation> queryRealisation(const DrvOutput&) override
|
|
|
|
{ unsupported("queryRealisation"); }
|
2020-08-24 16:54:16 +00:00
|
|
|
};
|
|
|
|
|
2020-10-06 11:36:55 +00:00
|
|
|
static RegisterStoreImplementation<DummyStore, DummyStoreConfig> regDummyStore;
|
2020-08-24 16:54:16 +00:00
|
|
|
|
|
|
|
}
|