mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
Specialize LocalOverlayStore::queryPathInfoUncached
This commit is contained in:
parent
31e98ed0a0
commit
5406256d78
2 changed files with 29 additions and 0 deletions
|
@ -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<std::shared_ptr<const ValidPathInfo>> callback) noexcept
|
||||
{
|
||||
|
||||
auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback));
|
||||
|
||||
// If we don't have it, check lower store
|
||||
LocalStore::queryPathInfoUncached(path,
|
||||
{[this, path, callbackPtr](std::future<std::shared_ptr<const ValidPathInfo>> fut) {
|
||||
try {
|
||||
(*callbackPtr)(fut.get());
|
||||
} catch (...) {
|
||||
lowerStore->queryPathInfo(path,
|
||||
{[path, callbackPtr](std::future<ref<const ValidPathInfo>> fut) {
|
||||
try {
|
||||
(*callbackPtr)(fut.get().get_ptr());
|
||||
} catch (...) {
|
||||
callbackPtr->rethrow();
|
||||
}
|
||||
}});
|
||||
}
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
static RegisterStoreImplementation<LocalOverlayStore, LocalOverlayStoreConfig> regLocalOverlayStore;
|
||||
|
||||
}
|
||||
|
|
|
@ -71,6 +71,9 @@ private:
|
|||
// Overridden methods…
|
||||
|
||||
void registerDrvOutput(const Realisation & info) override;
|
||||
|
||||
void queryPathInfoUncached(const StorePath & path,
|
||||
Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue