about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-30T12·53+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-30T13·18+0200
commitbac123ddd9eaecb9044f7d7c9572f77825a18ad5 (patch)
tree51293a222a745d0cfa4dd00fe5d63956e9baf170 /src
parent3593c8285dec644f07156496fd8cd84ef70ec665 (diff)
Test the NAR info cache
Diffstat (limited to 'src')
-rw-r--r--src/libstore/local-binary-cache-store.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index e979a94b7aca..b418c9c04148 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -1,5 +1,6 @@
 #include "binary-cache-store.hh"
 #include "globals.hh"
+#include "nar-info-disk-cache.hh"
 
 namespace nix {
 
@@ -16,6 +17,9 @@ public:
         : BinaryCacheStore(params)
         , binaryCacheDir(binaryCacheDir)
     {
+        /* For testing the NAR info cache. */
+        if (getEnv("_NIX_CACHE_FILE_URLS") == "1")
+            diskCache = getNarInfoDiskCache();
     }
 
     void init() override;
@@ -53,6 +57,9 @@ void LocalBinaryCacheStore::init()
 {
     createDirs(binaryCacheDir + "/nar");
     BinaryCacheStore::init();
+
+    if (diskCache && !diskCache->cacheExists(getUri()))
+        diskCache->createCache(getUri(), wantMassQuery_, priority);
 }
 
 static void atomicWrite(const Path & path, const std::string & s)