From 7850d3d27910c30232dd09dd86ee8afdaad26b90 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Jun 2016 14:49:12 +0200 Subject: Make the store directory a member variable of Store --- src/libstore/binary-cache-store.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 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 1a95e01a5e26..668f1e566c01 100644 --- a/src/libstore/binary-cache-store.cc +++ b/src/libstore/binary-cache-store.cc @@ -14,8 +14,9 @@ namespace nix { -BinaryCacheStore::BinaryCacheStore(const StoreParams & params) - : compression(get(params, "compression", "xz")) +BinaryCacheStore::BinaryCacheStore(const Params & params) + : Store(params) + , compression(get(params, "compression", "xz")) { auto secretKeyFile = get(params, "secret-key", ""); if (secretKeyFile != "") @@ -32,7 +33,7 @@ void BinaryCacheStore::init() auto cacheInfo = getFile(cacheInfoFile); if (!cacheInfo) { - upsertFile(cacheInfoFile, "StoreDir: " + settings.nixStore + "\n"); + upsertFile(cacheInfoFile, "StoreDir: " + storeDir + "\n"); } else { for (auto & line : tokenizeString(*cacheInfo, "\n")) { size_t colon = line.find(':'); @@ -40,9 +41,9 @@ void BinaryCacheStore::init() auto name = line.substr(0, colon); auto value = trim(line.substr(colon + 1, std::string::npos)); if (name == "StoreDir") { - if (value != settings.nixStore) + if (value != storeDir) throw Error(format("binary cache ‘%s’ is for Nix stores with prefix ‘%s’, not ‘%s’") - % getUri() % value % settings.nixStore); + % getUri() % value % storeDir); } else if (name == "WantMassQuery") { wantMassQuery_ = value == "1"; } else if (name == "Priority") { @@ -181,7 +182,7 @@ std::shared_ptr BinaryCacheStore::queryPathInfoUncached(const Pat auto data = getFile(narInfoFile); if (!data) return 0; - auto narInfo = make_ref(*data, narInfoFile); + auto narInfo = make_ref(*this, *data, narInfoFile); stats.narInfoRead++; @@ -249,7 +250,7 @@ struct BinaryCacheStoreAccessor : public FSAccessor { auto path = canonPath(path_); - auto storePath = toStorePath(path); + auto storePath = store->toStorePath(path); std::string restPath = std::string(path, storePath.size()); if (!store->isValidPath(storePath)) -- cgit 1.4.1