about summary refs log tree commit diff
path: root/src/libstore/http-binary-cache-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-30T11·33+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-30T13·18+0200
commite2224844019d58fc947ce00e18e9fa9974d2c8b5 (patch)
tree20204fa548e7a926e838486c63250572f4d6c2e8 /src/libstore/http-binary-cache-store.cc
parentb66ab6cdbce5f4ac2db8976872547680242166e8 (diff)
Re-implement the WantMassQuery property of binary caches
Diffstat (limited to 'src/libstore/http-binary-cache-store.cc')
-rw-r--r--src/libstore/http-binary-cache-store.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 073f76cc9e..8c8d545c6d 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -5,6 +5,8 @@
 
 namespace nix {
 
+MakeError(UploadToHTTP, Error);
+
 class HttpBinaryCacheStore : public BinaryCacheStore
 {
 private:
@@ -38,9 +40,12 @@ public:
     {
         // FIXME: do this lazily?
         if (!diskCache->cacheExists(cacheUri)) {
-            if (!fileExists("nix-cache-info"))
+            try {
+                BinaryCacheStore::init();
+            } catch (UploadToHTTP &) {
                 throw Error(format("‘%s’ does not appear to be a binary cache") % cacheUri);
-            diskCache->createCache(cacheUri);
+            }
+            diskCache->createCache(cacheUri, wantMassQuery_, priority);
         }
     }
 
@@ -66,7 +71,7 @@ protected:
 
     void upsertFile(const std::string & path, const std::string & data) override
     {
-        throw Error("uploading to an HTTP binary cache is not supported");
+        throw UploadToHTTP("uploading to an HTTP binary cache is not supported");
     }
 
     std::shared_ptr<std::string> getFile(const std::string & path) override