diff options
Diffstat (limited to 'src/libstore/local-binary-cache-store.cc')
-rw-r--r-- | src/libstore/local-binary-cache-store.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc index ae0ffa6a56ef..b7001795be4d 100644 --- a/src/libstore/local-binary-cache-store.cc +++ b/src/libstore/local-binary-cache-store.cc @@ -34,15 +34,14 @@ protected: const std::string & data, const std::string & mimeType) override; - void getFile(const std::string & path, - Callback<std::shared_ptr<std::string>> callback) override + void getFile(const std::string & path, Sink & sink) override { try { - // FIXME: O(n) space - callback(std::make_shared<std::string>(readFile(binaryCacheDir + "/" + path))); + readFile(binaryCacheDir + "/" + path, sink); } catch (SysError & e) { - if (e.errNo == ENOENT) callback(nullptr); else callback.rethrow(); - } catch (...) { callback.rethrow(); } + if (e.errNo == ENOENT) + throw NoSuchBinaryCacheFile("file '%s' does not exist in binary cache", path); + } } PathSet queryAllValidPaths() override |