diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc index a10c9d106..8590aea18 100644 --- a/src/libstore/local-binary-cache-store.cc +++ b/src/libstore/local-binary-cache-store.cc @@ -65,13 +65,21 @@ std::string LocalBinaryCacheStore::getFile(const std::string & path) return readFile(binaryCacheDir + "/" + path); } +ref openLocalBinaryCacheStore(std::shared_ptr localStore, + const Path & secretKeyFile, const Path & publicKeyFile, + const Path & binaryCacheDir) +{ + auto store = std::make_shared( + localStore, secretKeyFile, publicKeyFile, binaryCacheDir); + store->init(); + return ref(std::shared_ptr(store)); +} + static RegisterStoreImplementation regStore([](const std::string & uri) -> std::shared_ptr { if (std::string(uri, 0, 7) != "file://") return 0; - auto store = std::make_shared(std::shared_ptr(0), + return openLocalBinaryCacheStore(std::shared_ptr(0), "", "", // FIXME: allow the signing key to be set std::string(uri, 7)); - store->init(); - return store; }); } diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 97e834ed2..9825d45db 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -453,6 +453,11 @@ ref openStoreAt(const std::string & uri); ref openStore(); +ref openLocalBinaryCacheStore(std::shared_ptr localStore, + const Path & secretKeyFile, const Path & publicKeyFile, + const Path & binaryCacheDir); + + /* Store implementation registration. */ typedef std::function(const std::string & uri)> OpenStore;