aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/http-binary-cache-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-12-17 17:17:53 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-12-17 17:17:53 +0100
commitf8abbdd4565542464f31f4dc203a9c3e091b3536 (patch)
tree5a582db41f23602b441a7fcb5ede5339fc1b6d42 /src/libstore/http-binary-cache-store.cc
parent54bf5ba4227a234f8cd5102634b9a3b535e6fbdb (diff)
Add priority setting to stores
This allows overriding the priority of substituters, e.g. $ nix-store --store ~/my-nix/ -r /nix/store/df3m4da96d84ljzxx4mygfshm1p0r2n3-geeqie-1.4 \ --substituters 'http://cache.nixos.org?priority=100 daemon?priority=10' Fixes #3264.
Diffstat (limited to 'src/libstore/http-binary-cache-store.cc')
-rw-r--r--src/libstore/http-binary-cache-store.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 779f89e68..d4ae36662 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -42,13 +42,16 @@ public:
void init() override
{
// FIXME: do this lazily?
- if (!diskCache->cacheExists(cacheUri, wantMassQuery_, priority)) {
+ if (auto cacheInfo = diskCache->cacheExists(cacheUri)) {
+ wantMassQuery.setDefault(cacheInfo->wantMassQuery ? "true" : "false");
+ priority.setDefault(fmt("%d", cacheInfo->priority));
+ } else {
try {
BinaryCacheStore::init();
} catch (UploadToHTTP &) {
throw Error("'%s' does not appear to be a binary cache", cacheUri);
}
- diskCache->createCache(cacheUri, storeDir, wantMassQuery_, priority);
+ diskCache->createCache(cacheUri, storeDir, wantMassQuery, priority);
}
}