about summary refs log tree commit diff
path: root/src/libstore/store-api.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-17T22·55-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-17T22·55-0400
commitccc52adfb2121ade510d35dc9b91193af9fa731e (patch)
treec6314b5198cdfbe9a21633e515203965ee431382 /src/libstore/store-api.hh
parent220818f758d2facc194f567f35ca677ef79393bd (diff)
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/<hash>* is expensive since it requires reading the entire
directory.  queryPathFromHashPart() prevents this by doing a cheap
database lookup.
Diffstat (limited to 'src/libstore/store-api.hh')
-rw-r--r--src/libstore/store-api.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index bf3269f57818..0ab15c38063e 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -139,6 +139,10 @@ public:
 
     /* Query the output names of the derivation denoted by `path'. */
     virtual StringSet queryDerivationOutputNames(const Path & path) = 0;
+
+    /* Query the full store path given the hash part of a valid store
+       path, or "" if the path doesn't exist. */
+    virtual Path queryPathFromHashPart(const string & hashPart) = 0;
     
     /* Query whether a path has substitutes. */
     virtual bool hasSubstitutes(const Path & path) = 0;