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