about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/binary-cache-store.cc63
-rw-r--r--src/libstore/binary-cache-store.hh14
-rw-r--r--src/libstore/http-binary-cache-store.cc7
-rw-r--r--src/libstore/local-binary-cache-store.cc7
-rw-r--r--src/libstore/s3-binary-cache-store.cc7
-rw-r--r--src/libstore/s3-binary-cache-store.hh5
6 files changed, 20 insertions, 83 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc
index b56f3ee8a1f8..642da9f0477e 100644
--- a/src/libstore/binary-cache-store.cc
+++ b/src/libstore/binary-cache-store.cc
@@ -14,10 +14,8 @@
 
 namespace nix {
 
-BinaryCacheStore::BinaryCacheStore(std::shared_ptr<Store> localStore,
-    const StoreParams & params)
-    : localStore(localStore)
-    , compression(get(params, "compression", "xz"))
+BinaryCacheStore::BinaryCacheStore(const StoreParams & params)
+    : compression(get(params, "compression", "xz"))
 {
     auto secretKeyFile = get(params, "secret-key", "");
     if (secretKeyFile != "")
@@ -170,30 +168,6 @@ std::shared_ptr<ValidPathInfo> BinaryCacheStore::queryPathInfoUncached(const Pat
     return std::shared_ptr<NarInfo>(narInfo);
 }
 
-void BinaryCacheStore::querySubstitutablePathInfos(const PathSet & paths,
-    SubstitutablePathInfos & infos)
-{
-    PathSet left;
-
-    if (!localStore) return;
-
-    for (auto & storePath : paths) {
-        try {
-            auto info = localStore->queryPathInfo(storePath);
-            SubstitutablePathInfo sub;
-            sub.references = info->references;
-            sub.downloadSize = 0;
-            sub.narSize = info->narSize;
-            infos.emplace(storePath, sub);
-        } catch (InvalidPath &) {
-            left.insert(storePath);
-        }
-    }
-
-    if (settings.useSubstitutes)
-        localStore->querySubstitutablePathInfos(left, infos);
-}
-
 Path BinaryCacheStore::addToStore(const string & name, const Path & srcPath,
     bool recursive, HashType hashAlgo, PathFilter & filter, bool repair)
 {
@@ -237,39 +211,6 @@ Path BinaryCacheStore::addTextToStore(const string & name, const string & s,
     return info.path;
 }
 
-void BinaryCacheStore::buildPaths(const PathSet & paths, BuildMode buildMode)
-{
-    for (auto & storePath : paths) {
-        assert(!isDerivation(storePath));
-
-        if (isValidPath(storePath)) continue;
-
-        if (!localStore)
-            throw Error(format("don't know how to realise path ‘%1%’ in a binary cache") % storePath);
-
-        localStore->addTempRoot(storePath);
-
-        if (!localStore->isValidPath(storePath))
-            localStore->ensurePath(storePath);
-
-        auto info = localStore->queryPathInfo(storePath);
-
-        for (auto & ref : info->references)
-            if (ref != storePath)
-                ensurePath(ref);
-
-        StringSink sink;
-        dumpPath(storePath, sink);
-
-        addToStore(*info, *sink.s, buildMode == bmRepair);
-    }
-}
-
-void BinaryCacheStore::ensurePath(const Path & path)
-{
-    buildPaths({path});
-}
-
 /* Given requests for a path /nix/store/<x>/<y>, this accessor will
    first download the NAR for /nix/store/<x> from the binary cache,
    build a NAR accessor for that NAR, and use that to access <y>. */
diff --git a/src/libstore/binary-cache-store.hh b/src/libstore/binary-cache-store.hh
index cc6b98525e23..bb67a8581a36 100644
--- a/src/libstore/binary-cache-store.hh
+++ b/src/libstore/binary-cache-store.hh
@@ -17,14 +17,11 @@ private:
 
     std::unique_ptr<SecretKey> secretKey;
 
-    std::shared_ptr<Store> localStore;
-
     std::string compression;
 
 protected:
 
-    BinaryCacheStore(std::shared_ptr<Store> localStore,
-        const StoreParams & params);
+    BinaryCacheStore(const StoreParams & params);
 
     [[noreturn]] void notImpl();
 
@@ -78,7 +75,8 @@ public:
     { return {}; }
 
     void querySubstitutablePathInfos(const PathSet & paths,
-        SubstitutablePathInfos & infos) override;
+        SubstitutablePathInfos & infos)
+    { }
 
     void addToStore(const ValidPathInfo & info, const std::string & nar,
         bool repair = false) override;
@@ -92,13 +90,15 @@ public:
 
     void narFromPath(const Path & path, Sink & sink) override;
 
-    void buildPaths(const PathSet & paths, BuildMode buildMode = bmNormal) override;
+    void buildPaths(const PathSet & paths, BuildMode buildMode = bmNormal) override
+    { notImpl(); }
 
     BuildResult buildDerivation(const Path & drvPath, const BasicDerivation & drv,
         BuildMode buildMode = bmNormal) override
     { notImpl(); }
 
-    void ensurePath(const Path & path) override;
+    void ensurePath(const Path & path) override
+    { notImpl(); }
 
     void addTempRoot(const Path & path) override
     { notImpl(); }
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
index 92d94aeeacd5..073f76cc9e65 100644
--- a/src/libstore/http-binary-cache-store.cc
+++ b/src/libstore/http-binary-cache-store.cc
@@ -15,9 +15,9 @@ private:
 
 public:
 
-    HttpBinaryCacheStore(std::shared_ptr<Store> localStore,
+    HttpBinaryCacheStore(
         const StoreParams & params, const Path & _cacheUri)
-        : BinaryCacheStore(localStore, params)
+        : BinaryCacheStore(params)
         , cacheUri(_cacheUri)
         , downloaders(
             std::numeric_limits<size_t>::max(),
@@ -91,8 +91,7 @@ static RegisterStoreImplementation regStore([](
 {
     if (std::string(uri, 0, 7) != "http://" &&
         std::string(uri, 0, 8) != "https://") return 0;
-    auto store = std::make_shared<HttpBinaryCacheStore>(std::shared_ptr<Store>(0),
-        params, uri);
+    auto store = std::make_shared<HttpBinaryCacheStore>(params, uri);
     store->init();
     return store;
 });
diff --git a/src/libstore/local-binary-cache-store.cc b/src/libstore/local-binary-cache-store.cc
index 2c2944938761..e979a94b7aca 100644
--- a/src/libstore/local-binary-cache-store.cc
+++ b/src/libstore/local-binary-cache-store.cc
@@ -11,9 +11,9 @@ private:
 
 public:
 
-    LocalBinaryCacheStore(std::shared_ptr<Store> localStore,
+    LocalBinaryCacheStore(
         const StoreParams & params, const Path & binaryCacheDir)
-        : BinaryCacheStore(localStore, params)
+        : BinaryCacheStore(params)
         , binaryCacheDir(binaryCacheDir)
     {
     }
@@ -90,8 +90,7 @@ static RegisterStoreImplementation regStore([](
     -> std::shared_ptr<Store>
 {
     if (std::string(uri, 0, 7) != "file://") return 0;
-    auto store = std::make_shared<LocalBinaryCacheStore>(
-        std::shared_ptr<Store>(0), params, std::string(uri, 7));
+    auto store = std::make_shared<LocalBinaryCacheStore>(params, std::string(uri, 7));
     store->init();
     return store;
 });
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc
index e64d0eb852aa..bd8abe482152 100644
--- a/src/libstore/s3-binary-cache-store.cc
+++ b/src/libstore/s3-binary-cache-store.cc
@@ -46,9 +46,9 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
 
     Stats stats;
 
-    S3BinaryCacheStoreImpl(std::shared_ptr<Store> localStore,
+    S3BinaryCacheStoreImpl(
         const StoreParams & params, const std::string & bucketName)
-        : S3BinaryCacheStore(localStore, params)
+        : S3BinaryCacheStore(params)
         , bucketName(bucketName)
         , config(makeConfig())
         , client(make_ref<Aws::S3::S3Client>(*config))
@@ -248,8 +248,7 @@ static RegisterStoreImplementation regStore([](
     -> std::shared_ptr<Store>
 {
     if (std::string(uri, 0, 5) != "s3://") return 0;
-    auto store = std::make_shared<S3BinaryCacheStoreImpl>(std::shared_ptr<Store>(0),
-        params, std::string(uri, 5));
+    auto store = std::make_shared<S3BinaryCacheStoreImpl>(params, std::string(uri, 5));
     store->init();
     return store;
 });
diff --git a/src/libstore/s3-binary-cache-store.hh b/src/libstore/s3-binary-cache-store.hh
index 2751a9d01cdb..3f9bd891274b 100644
--- a/src/libstore/s3-binary-cache-store.hh
+++ b/src/libstore/s3-binary-cache-store.hh
@@ -10,9 +10,8 @@ class S3BinaryCacheStore : public BinaryCacheStore
 {
 protected:
 
-    S3BinaryCacheStore(std::shared_ptr<Store> localStore,
-        const StoreParams & params)
-        : BinaryCacheStore(localStore, params)
+    S3BinaryCacheStore(const StoreParams & params)
+        : BinaryCacheStore(params)
     { }
 
 public: