1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-05 08:31:00 +01:00

Declare DummyStoreConfig in a header

This will useful for unit tests.
This commit is contained in:
John Ericson 2025-09-17 15:20:42 -04:00
parent 613de9d9cc
commit 168c24b605
3 changed files with 47 additions and 38 deletions

View file

@ -1,48 +1,15 @@
#include "nix/store/store-registration.hh"
#include "nix/util/callback.hh"
#include "nix/store/dummy-store.hh"
namespace nix {
struct DummyStoreConfig : public std::enable_shared_from_this<DummyStoreConfig>, virtual StoreConfig
std::string DummyStoreConfig::doc()
{
using StoreConfig::StoreConfig;
DummyStoreConfig(std::string_view scheme, std::string_view authority, const Params & params)
: StoreConfig(params)
{
if (!authority.empty())
throw UsageError("`%s` store URIs must not contain an authority part %s", scheme, authority);
}
static const std::string name()
{
return "Dummy Store";
}
static std::string doc()
{
return
return
#include "dummy-store.md"
;
}
static StringSet uriSchemes()
{
return {"dummy"};
}
ref<Store> openStore() const override;
StoreReference getReference() const override
{
return {
.variant =
StoreReference::Specified{
.scheme = *uriSchemes().begin(),
},
};
}
};
;
}
struct DummyStore : virtual Store
{