diff options
author | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-07-17 17:24:02 -0400 |
---|---|---|
committer | Carlo Nucera <carlo.nucera@protonmail.com> | 2020-07-17 17:24:02 -0400 |
commit | 0aa79dcc6f4e67891cdd9500ae4ce85e4189a951 (patch) | |
tree | ba77166ca10df3569dc3f20c78a78543424fd913 /src/libstore/local-store.cc | |
parent | 4178f36a1d4005a78a024c60d1f024c6ecccf8e8 (diff) |
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.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r-- | src/libstore/local-store.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index d49d00d6d..9752f3c5f 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1580,4 +1580,20 @@ void LocalStore::createUser(const std::string & userName, uid_t userId) } +static RegisterStoreImplementation regStore([]( + const std::string & uri, const Store::Params & params) + -> std::shared_ptr<Store> +{ + Store::Params params2 = params; + if (uri == "local") { + } else if (hasPrefix(uri, "/")) { + params2["root"] = uri; + } else if (hasPrefix(uri, "./")) { + params2["root"] = absPath(uri); + } else { + return nullptr; + } + return std::shared_ptr<Store>(std::make_shared<LocalStore>(params2)); +}); + } |