diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-04-17 11:58:47 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-08-02 15:46:38 -0400 |
commit | 3b592c880ae76707cc832e5f227e261be29661bf (patch) | |
tree | 8ffcf145ccc3a9cceaaca004e64f0fa8915a3a9e /src | |
parent | 3723363697b3908a2f58dce3e706783b1c783414 (diff) |
Add infra for experimental store implemenations
This is analogous to that for experimental settings and flags that we
have also added as of late.
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/store-api.cc | 1 | ||||
-rw-r--r-- | src/libstore/store-api.hh | 15 | ||||
-rw-r--r-- | src/nix/main.cc | 6 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 4ea16a1c0..28689e100 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -1496,6 +1496,7 @@ ref<Store> openStore(const std::string & uri_, if (implem.uriSchemes.count(parsedUri.scheme)) { auto store = implem.create(parsedUri.scheme, baseURI, params); if (store) { + experimentalFeatureSettings.require(store->experimentalFeature()); store->init(); store->warnUnknownSettings(); return ref<Store>(store); diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 3758c730f..f9029ade1 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -109,13 +109,28 @@ struct StoreConfig : public Config virtual ~StoreConfig() { } + /** + * The name of this type of store. + */ virtual const std::string name() = 0; + /** + * Documentation for this type of store. + */ virtual std::string doc() { return ""; } + /** + * An experimental feature this type store is gated, if it is to be + * experimental. + */ + virtual std::optional<ExperimentalFeature> experimentalFeature() const + { + return std::nullopt; + } + const PathSetting storeDir_{this, settings.nixStore, "store", R"( diff --git a/src/nix/main.cc b/src/nix/main.cc index df66beb8c..c5a9c8b33 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -180,8 +180,10 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs for (auto & implem : *Implementations::registered) { auto storeConfig = implem.getConfig(); auto storeName = storeConfig->name(); - stores[storeName]["doc"] = storeConfig->doc(); - stores[storeName]["settings"] = storeConfig->toJSON(); + auto & j = stores[storeName]; + j["doc"] = storeConfig->doc(); + j["settings"] = storeConfig->toJSON(); + j["experimentalFeature"] = storeConfig->experimentalFeature(); } res["stores"] = std::move(stores); |