mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
New store settings system
Motivation: See the linked issues for details. The most notable user-relevant bits are: - This cleans up the `MountedSSHStore`: decomposed into its orthogonal parts - This brings us pretty close to being able to then implement a JSON-based config. - Store query parameters can be JSON - Stores can entirely be specified via JSON objects, but this is not yet hooked up to anything. Also behind the scenes have these benefits: 1. The docs are moved out of the headers, good for less rebuilding when they changes 2. Stores are always constructed from store configs 3. Use JSON, avoid custom serializers Context: Part of #11106 Co-Authored-By: Robert Hensing <robert@roberthensing.nl> Co-authored-by: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com>
This commit is contained in:
parent
bf5d544d3b
commit
2ea9f59978
69 changed files with 2062 additions and 701 deletions
|
@ -8,12 +8,21 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
config::SettingDescriptionMap LocalBinaryCacheStoreConfig::descriptions()
|
||||
{
|
||||
config::SettingDescriptionMap ret;
|
||||
ret.merge(StoreConfig::descriptions());
|
||||
ret.merge(BinaryCacheStoreConfig::descriptions());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
LocalBinaryCacheStoreConfig::LocalBinaryCacheStoreConfig(
|
||||
std::string_view scheme,
|
||||
PathView binaryCacheDir,
|
||||
const StoreReference::Params & params)
|
||||
: Store::Config{params}
|
||||
, BinaryCacheStoreConfig{params}
|
||||
, BinaryCacheStoreConfig{*this, params}
|
||||
, binaryCacheDir(binaryCacheDir)
|
||||
{
|
||||
}
|
||||
|
@ -32,9 +41,9 @@ struct LocalBinaryCacheStore :
|
|||
{
|
||||
using Config = LocalBinaryCacheStoreConfig;
|
||||
|
||||
ref<Config> config;
|
||||
ref<const Config> config;
|
||||
|
||||
LocalBinaryCacheStore(ref<Config> config)
|
||||
LocalBinaryCacheStore(ref<const Config> config)
|
||||
: Store{*config}
|
||||
, BinaryCacheStore{*config}
|
||||
, config{config}
|
||||
|
@ -126,10 +135,7 @@ StringSet LocalBinaryCacheStoreConfig::uriSchemes()
|
|||
}
|
||||
|
||||
ref<Store> LocalBinaryCacheStoreConfig::openStore() const {
|
||||
return make_ref<LocalBinaryCacheStore>(ref{
|
||||
// FIXME we shouldn't actually need a mutable config
|
||||
std::const_pointer_cast<LocalBinaryCacheStore::Config>(shared_from_this())
|
||||
});
|
||||
return make_ref<LocalBinaryCacheStore>(ref{shared_from_this()});
|
||||
}
|
||||
|
||||
static RegisterStoreImplementation<LocalBinaryCacheStore::Config> regLocalBinaryCacheStore;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue