diff --git a/src/libstore/dummy-store.cc b/src/libstore/dummy-store.cc index 2f3269b6830..503ec346d13 100644 --- a/src/libstore/dummy-store.cc +++ b/src/libstore/dummy-store.cc @@ -12,7 +12,7 @@ DummyStoreConfig::DummyStoreConfig( throw UsageError("`%s` store URIs must not contain an authority part %s", scheme, authority); } -std::string DummyStoreConfig::doc() +std::string DummyStoreConfig::doc() const { return #include "dummy-store.md" @@ -20,22 +20,20 @@ std::string DummyStoreConfig::doc() } -const DummyStoreConfig::Descriptions DummyStoreConfig::descriptions{}; - - -struct DummyStore : public virtual DummyStoreConfig, public virtual Store +struct DummyStore : virtual Store { using Config = DummyStoreConfig; - DummyStore(const Config & config) - : StoreConfig(config) - , DummyStoreConfig(config) - , Store{static_cast(*this)} + ref config; + + DummyStore(ref config) + : Store{*config} + , config(config) { } std::string getUri() override { - return *uriSchemes().begin(); + return *Config::uriSchemes().begin() + "://"; } void queryPathInfoUncached(const StorePath & path, @@ -82,7 +80,7 @@ struct DummyStore : public virtual DummyStoreConfig, public virtual Store ref DummyStore::Config::openStore() const { - return make_ref(*this); + return make_ref(ref{shared_from_this()}); } static RegisterStoreImplementation regDummyStore; diff --git a/src/libstore/store-registration.cc b/src/libstore/store-registration.cc index 306416b2681..00bd522d600 100644 --- a/src/libstore/store-registration.cc +++ b/src/libstore/store-registration.cc @@ -123,11 +123,12 @@ ref adl_serializer>::from_json(const j case json::value_t::object: { auto & obj = json.get_ref(); - ref = StoreReference { - .variant = StoreReference::Specified{ - .scheme = getString(valueAt(obj, "scheme")), - .authority = getString(valueAt(obj, "authority")), - }, + ref = StoreReference{ + .variant = + StoreReference::Specified{ + .scheme = getString(valueAt(obj, "scheme")), + .authority = getString(valueAt(obj, "authority")), + }, .params = obj, }; break; @@ -143,8 +144,7 @@ ref adl_serializer>::from_json(const j case json::value_t::discarded: default: throw UsageError( - "Invalid JSON for Store configuration: is type '%s' but must be string or object", - json.type_name()); + "Invalid JSON for Store configuration: is type '%s' but must be string or object", json.type_name()); }; return resolveStoreConfig(std::move(ref));