diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-19 18:50:15 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-19 18:52:53 +0200 |
commit | e0204f8d462041387651af388074491fd0bf36d6 (patch) | |
tree | ecd20759ce49499722d140d653c5678051bcdfc2 /src/nix/verify.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/nix/verify.cc')
-rw-r--r-- | src/nix/verify.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nix/verify.cc b/src/nix/verify.cc index 39a4395cf..da1567808 100644 --- a/src/nix/verify.cc +++ b/src/nix/verify.cc @@ -83,16 +83,16 @@ struct CmdVerify : StorePathsCommand if (!noContents) { - HashSink sink(info.narHash.type); + HashSink sink(info->narHash.type); store->narFromPath(storePath, sink); auto hash = sink.finish(); - if (hash.first != info.narHash) { + if (hash.first != info->narHash) { corrupted = 1; printMsg(lvlError, format("path ‘%s’ was modified! expected hash ‘%s’, got ‘%s’") - % storePath % printHash(info.narHash) % printHash(hash.first)); + % storePath % printHash(info->narHash) % printHash(hash.first)); } } @@ -101,7 +101,7 @@ struct CmdVerify : StorePathsCommand bool good = false; - if (info.ultimate && !sigsNeeded) + if (info->ultimate && !sigsNeeded) good = true; else { @@ -114,18 +114,18 @@ struct CmdVerify : StorePathsCommand for (auto sig : sigs) { if (sigsSeen.count(sig)) continue; sigsSeen.insert(sig); - if (info.checkSignature(publicKeys, sig)) + if (info->checkSignature(publicKeys, sig)) validSigs++; } }; - doSigs(info.sigs); + doSigs(info->sigs); for (auto & store2 : substituters) { if (validSigs >= actualSigsNeeded) break; try { - if (!store2->isValidPath(storePath)) continue; - doSigs(store2->queryPathInfo(storePath).sigs); + doSigs(store2->queryPathInfo(storePath)->sigs); + } catch (InvalidPath &) { } catch (Error & e) { printMsg(lvlError, format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what()); } |