From 5a8455c85e35706a34892bea5b2a0c72f25663a1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 2 Mar 2016 18:21:48 +0100 Subject: [PATCH] Provide function required by Hydra --- src/libstore/local-binary-cache-store.cc | 14 +++++++++++--- src/libstore/store-api.hh | 5 +++++ 2 files changed, 16 insertions(+), 3 deletions(-) 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;