diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-03-14 12:29:32 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-03-14 12:33:06 +0100 |
commit | e7c76f7274c53a6bce87c3ae637d12743688bc0e (patch) | |
tree | 6338d8a5cf60c8ffbb9501fbd9808fbf52336ea7 /src/libstore | |
parent | 674c5ff64fd518ae7bc64a325b75f0a534e74905 (diff) |
BinaryCacheStore::isValidPath(): Use .narinfo cache
If a path is in the .narinfo cache, obviously it's valid.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/binary-cache-store.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc index 5ded16d02..94f5cbabb 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -141,6 +141,15 @@ NarInfo BinaryCacheStore::readNarInfo(const Path & storePath) bool BinaryCacheStore::isValidPath(const Path & storePath) { + { + auto state_(state.lock()); + auto res = state_->narInfoCache.get(storePath); + if (res) { + stats.narInfoReadAverted++; + return true; + } + } + // FIXME: this only checks whether a .narinfo with a matching hash // part exists. So ‘f4kb...-foo’ matches ‘f4kb...-bar’, even // though they shouldn't. Not easily fixed. |