From ccc52adfb2121ade510d35dc9b91193af9fa731e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Jul 2012 18:55:39 -0400 Subject: Add function queryPathFromHashPart() To implement binary caches efficiently, Hydra needs to be able to map the hash part of a store path (e.g. "gbg...zr7") to the full store path (e.g. "/nix/store/gbg...kzr7-subversion-1.7.5"). (The binary cache mechanism uses hash parts as a key for looking up store paths to ensure privacy.) However, doing a search in the Nix store for /nix/store/* is expensive since it requires reading the entire directory. queryPathFromHashPart() prevents this by doing a cheap database lookup. --- src/libstore/remote-store.hh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libstore/remote-store.hh') diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index e9f40da6dbf4..f0e5dbf7695a 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -43,6 +43,8 @@ public: StringSet queryDerivationOutputNames(const Path & path); + Path queryPathFromHashPart(const string & hashPart); + bool hasSubstitutes(const Path & path); bool querySubstitutablePathInfo(const Path & path, -- cgit 1.4.1