diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-19T16·50+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-19T16·52+0200 |
commit | e0204f8d462041387651af388074491fd0bf36d6 (patch) | |
tree | ecd20759ce49499722d140d653c5678051bcdfc2 /src/libstore/build.cc | |
parent | 608b0265e104b4a97f51e5745b1a32078770f3cf (diff) |
Move path info caching from BinaryCacheStore to Store
Caching path info is generally useful. For instance, it speeds up "nix path-info -rS /run/current-system" (i.e. showing the closure sizes of all paths in the closure of the current system) from 5.6s to 0.15s. This also eliminates some APIs like Store::queryDeriver() and Store::queryReferences().
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r-- | src/libstore/build.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 4b1c177fe27b..ae8078069d07 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -2724,7 +2724,7 @@ void DerivationGoal::registerOutputs() if (buildMode == bmCheck) { if (!worker.store.isValidPath(path)) continue; - ValidPathInfo info = worker.store.queryPathInfo(path); + auto info = *worker.store.queryPathInfo(path); if (hash.first != info.narHash) { if (settings.keepFailed) { Path dst = path + checkSuffix; @@ -3778,14 +3778,14 @@ bool Worker::pathContentsGood(const Path & path) std::map<Path, bool>::iterator i = pathContentsGoodCache.find(path); if (i != pathContentsGoodCache.end()) return i->second; printMsg(lvlInfo, format("checking path ‘%1%’...") % path); - ValidPathInfo info = store.queryPathInfo(path); + auto info = store.queryPathInfo(path); bool res; if (!pathExists(path)) res = false; else { - HashResult current = hashPath(info.narHash.type, path); + HashResult current = hashPath(info->narHash.type, path); Hash nullHash(htSHA256); - res = info.narHash == nullHash || info.narHash == current.first; + res = info->narHash == nullHash || info->narHash == current.first; } pathContentsGoodCache[path] = res; if (!res) printMsg(lvlError, format("path ‘%1%’ is corrupted or missing!") % path); @@ -3881,7 +3881,7 @@ void LocalStore::repairPath(const Path & path) if (goal->getExitCode() != Goal::ecSuccess) { /* Since substituting the path didn't work, if we have a valid deriver, then rebuild the deriver. */ - Path deriver = queryDeriver(path); + auto deriver = queryPathInfo(path)->deriver; if (deriver != "" && isValidPath(deriver)) { goals.clear(); goals.insert(worker.makeDerivationGoal(deriver, StringSet(), bmRepair)); |