1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-17 07:52:43 +01:00

Remove StoreType abstraction and delegate regStore

to each Store implementation. The generic regStore implementation will
only be for the ambiguous shorthands, like "" and "auto".

This also could get us close to simplifying the daemon command.
This commit is contained in:
Carlo Nucera 2020-07-17 17:24:02 -04:00
parent 4178f36a1d
commit 0aa79dcc6f
6 changed files with 41 additions and 51 deletions

View file

@ -843,14 +843,18 @@ std::exception_ptr RemoteStore::Connection::processStderr(Sink * sink, Source *
return nullptr;
}
static std::string uriScheme = "unix://";
static std::string_view uriScheme = "unix://";
static RegisterStoreImplementation regStore([](
const std::string & uri, const Store::Params & params)
-> std::shared_ptr<Store>
{
if (std::string(uri, 0, uriScheme.size()) != uriScheme) return 0;
return std::make_shared<UDSRemoteStore>(std::string(uri, uriScheme.size()), params);
if (hasPrefix(uri, uriScheme))
return std::make_shared<UDSRemoteStore>(std::string(uri, uriScheme.size()), params);
else if (uri == "daemon")
return std::make_shared<UDSRemoteStore>(params);
else
return nullptr;
});
}