diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-17 18:55:39 -0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-17 18:55:39 -0400 |
commit | ccc52adfb2121ade510d35dc9b91193af9fa731e (patch) | |
tree | c6314b5198cdfbe9a21633e515203965ee431382 /src/nix-worker | |
parent | 220818f758d2facc194f567f35ca677ef79393bd (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/nix-worker')
-rw-r--r-- | src/nix-worker/nix-worker.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index 2f0a2ab20..74a619c71 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -350,6 +350,15 @@ static void performOp(unsigned int clientVersion, break; } + case wopQueryPathFromHashPart: { + string hashPart = readString(from); + startWork(); + Path path = store->queryPathFromHashPart(hashPart); + stopWork(); + writeString(path, to); + break; + } + case wopAddToStore: { string baseName = readString(from); bool fixed = readInt(from) == 1; /* obsolete */ |