diff --git a/src/libstore/local-overlay-store.cc b/src/libstore/local-overlay-store.cc index 2e3564df9..545e8d28f 100644 --- a/src/libstore/local-overlay-store.cc +++ b/src/libstore/local-overlay-store.cc @@ -1,4 +1,5 @@ #include "local-overlay-store.hh" +#include "callback.hh" namespace nix { @@ -26,6 +27,31 @@ void LocalOverlayStore::registerDrvOutput(const Realisation & info) } +void LocalOverlayStore::queryPathInfoUncached(const StorePath & path, + Callback> callback) noexcept +{ + + auto callbackPtr = std::make_shared(std::move(callback)); + + // If we don't have it, check lower store + LocalStore::queryPathInfoUncached(path, + {[this, path, callbackPtr](std::future> fut) { + try { + (*callbackPtr)(fut.get()); + } catch (...) { + lowerStore->queryPathInfo(path, + {[path, callbackPtr](std::future> fut) { + try { + (*callbackPtr)(fut.get().get_ptr()); + } catch (...) { + callbackPtr->rethrow(); + } + }}); + } + }}); +} + + static RegisterStoreImplementation regLocalOverlayStore; } diff --git a/src/libstore/local-overlay-store.hh b/src/libstore/local-overlay-store.hh index e5329f5d9..12b705efb 100644 --- a/src/libstore/local-overlay-store.hh +++ b/src/libstore/local-overlay-store.hh @@ -71,6 +71,9 @@ private: // Overridden methods… void registerDrvOutput(const Realisation & info) override; + + void queryPathInfoUncached(const StorePath & path, + Callback> callback) noexcept override; }; }