diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-11-04 22:29:31 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-11-04 22:29:31 +0100 |
commit | b81d9d26f50784ab1884e2cc6bc470d5cba91bc9 (patch) | |
tree | bf1a03fff022f94271df102d045d6b33e677c2c6 /src/libstore/store-api.cc | |
parent | e34b317bbf778efb4e9bee5d34fb2ceb7776de3f (diff) | |
parent | f5a46ef0b1d76d32238f76ab8253f0d2d9fc72c9 (diff) |
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index ef8b9575f..ea91bf20e 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -320,10 +320,10 @@ bool Store::isValidPathUncached(const Path & path) ref<const ValidPathInfo> Store::queryPathInfo(const Path & storePath) { - std::promise<ref<ValidPathInfo>> promise; + std::promise<ref<const ValidPathInfo>> promise; queryPathInfo(storePath, - {[&](std::future<ref<ValidPathInfo>> result) { + {[&](std::future<ref<const ValidPathInfo>> result) { try { promise.set_value(result.get()); } catch (...) { @@ -336,7 +336,7 @@ ref<const ValidPathInfo> Store::queryPathInfo(const Path & storePath) void Store::queryPathInfo(const Path & storePath, - Callback<ref<ValidPathInfo>> callback) noexcept + Callback<ref<const ValidPathInfo>> callback) noexcept { std::string hashPart; @@ -351,7 +351,7 @@ void Store::queryPathInfo(const Path & storePath, stats.narInfoReadAverted++; if (!*res) throw InvalidPath(format("path '%s' is not valid") % storePath); - return callback(ref<ValidPathInfo>(*res)); + return callback(ref<const ValidPathInfo>(*res)); } } @@ -367,7 +367,7 @@ void Store::queryPathInfo(const Path & storePath, (res.second->path != storePath && storePathToName(storePath) != "")) throw InvalidPath(format("path '%s' is not valid") % storePath); } - return callback(ref<ValidPathInfo>(res.second)); + return callback(ref<const ValidPathInfo>(res.second)); } } @@ -376,7 +376,7 @@ void Store::queryPathInfo(const Path & storePath, auto callbackPtr = std::make_shared<decltype(callback)>(std::move(callback)); queryPathInfoUncached(storePath, - {[this, storePath, hashPart, callbackPtr](std::future<std::shared_ptr<ValidPathInfo>> fut) { + {[this, storePath, hashPart, callbackPtr](std::future<std::shared_ptr<const ValidPathInfo>> fut) { try { auto info = fut.get(); @@ -396,7 +396,7 @@ void Store::queryPathInfo(const Path & storePath, throw InvalidPath("path '%s' is not valid", storePath); } - (*callbackPtr)(ref<ValidPathInfo>(info)); + (*callbackPtr)(ref<const ValidPathInfo>(info)); } catch (...) { callbackPtr->rethrow(); } }}); } @@ -418,7 +418,7 @@ PathSet Store::queryValidPaths(const PathSet & paths, SubstituteFlag maybeSubsti auto doQuery = [&](const Path & path ) { checkInterrupt(); - queryPathInfo(path, {[path, &state_, &wakeup](std::future<ref<ValidPathInfo>> fut) { + queryPathInfo(path, {[path, &state_, &wakeup](std::future<ref<const ValidPathInfo>> fut) { auto state(state_.lock()); try { auto info = fut.get(); |