From 3be2e71ab31200e3d263d6d2aeb4bf85462156a0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 4 May 2016 20:15:41 +0200 Subject: BinaryCacheStore: Remove buildPaths() / ensurePath() --- src/libstore/binary-cache-store.cc | 63 ++------------------------------------ 1 file changed, 2 insertions(+), 61 deletions(-) (limited to 'src/libstore/binary-cache-store.cc') 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 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 BinaryCacheStore::queryPathInfoUncached(const Pat return std::shared_ptr(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//, this accessor will first download the NAR for /nix/store/ from the binary cache, build a NAR accessor for that NAR, and use that to access . */ -- cgit 1.4.1