Avoid some StorePath
<-> Path
round trips
Avoid needless work and throwing away invariants. These conversions date back to when `StorePath` was in Rust and there were issues with it missing utility methods.
This commit is contained in:
parent
c79b1582a7
commit
f3e272ba02
|
@ -742,13 +742,13 @@ StorePathSet Store::queryValidPaths(const StorePathSet & paths, SubstituteFlag m
|
||||||
std::condition_variable wakeup;
|
std::condition_variable wakeup;
|
||||||
ThreadPool pool;
|
ThreadPool pool;
|
||||||
|
|
||||||
auto doQuery = [&](const Path & path) {
|
auto doQuery = [&](const StorePath & path) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
queryPathInfo(parseStorePath(path), {[path, this, &state_, &wakeup](std::future<ref<const ValidPathInfo>> fut) {
|
queryPathInfo(path, {[path, this, &state_, &wakeup](std::future<ref<const ValidPathInfo>> fut) {
|
||||||
auto state(state_.lock());
|
auto state(state_.lock());
|
||||||
try {
|
try {
|
||||||
auto info = fut.get();
|
auto info = fut.get();
|
||||||
state->valid.insert(parseStorePath(path));
|
state->valid.insert(path);
|
||||||
} catch (InvalidPath &) {
|
} catch (InvalidPath &) {
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
state->exc = std::current_exception();
|
state->exc = std::current_exception();
|
||||||
|
@ -760,7 +760,7 @@ StorePathSet Store::queryValidPaths(const StorePathSet & paths, SubstituteFlag m
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto & path : paths)
|
for (auto & path : paths)
|
||||||
pool.enqueue(std::bind(doQuery, printStorePath(path))); // FIXME
|
pool.enqueue(std::bind(doQuery, path));
|
||||||
|
|
||||||
pool.process();
|
pool.process();
|
||||||
|
|
||||||
|
|
|
@ -81,14 +81,14 @@ struct CmdVerify : StorePathsCommand
|
||||||
|
|
||||||
ThreadPool pool;
|
ThreadPool pool;
|
||||||
|
|
||||||
auto doPath = [&](const Path & storePath) {
|
auto doPath = [&](const StorePath & storePath) {
|
||||||
try {
|
try {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
|
|
||||||
MaintainCount<std::atomic<size_t>> mcActive(active);
|
MaintainCount<std::atomic<size_t>> mcActive(active);
|
||||||
update();
|
update();
|
||||||
|
|
||||||
auto info = store->queryPathInfo(store->parseStorePath(storePath));
|
auto info = store->queryPathInfo(storePath);
|
||||||
|
|
||||||
// Note: info->path can be different from storePath
|
// Note: info->path can be different from storePath
|
||||||
// for binary cache stores when using --all (since we
|
// for binary cache stores when using --all (since we
|
||||||
|
@ -173,7 +173,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto & storePath : storePaths)
|
for (auto & storePath : storePaths)
|
||||||
pool.enqueue(std::bind(doPath, store->printStorePath(storePath)));
|
pool.enqueue(std::bind(doPath, storePath));
|
||||||
|
|
||||||
pool.process();
|
pool.process();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue