diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc index c9fac531a44..7d4d3d6c711 100644 --- a/src/libfetchers/tarball.cc +++ b/src/libfetchers/tarball.cc @@ -69,7 +69,7 @@ DownloadFileResult downloadFile( auto hash = hashString(htSHA256, *res.data); ValidPathInfo info { *store, - ContentAddress { + StorePathDescriptor { .name = name, .info = FixedOutputInfo { { diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 299887ec1fc..1df95fb3e00 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -297,7 +297,7 @@ class Worker GoalPtr makeDerivationGoal(const StorePath & drvPath, const StringSet & wantedOutputs, BuildMode buildMode = bmNormal); std::shared_ptr makeBasicDerivationGoal(const StorePath & drvPath, const BasicDerivation & drv, BuildMode buildMode = bmNormal); - GoalPtr makeSubstitutionGoal(const StorePath & storePath, RepairFlag repair = NoRepair, std::optional ca = std::nullopt); + GoalPtr makeSubstitutionGoal(const StorePath & storePath, RepairFlag repair = NoRepair, std::optional ca = std::nullopt); /* Remove a dead goal. */ void removeGoal(GoalPtr goal); @@ -3717,7 +3717,7 @@ void DerivationGoal::registerOutputs() /* Check that fixed-output derivations produced the right outputs (i.e., the content hash should match the specified hash). */ - std::optional ca; + std::optional ca; if (fixedOutput) { @@ -3773,7 +3773,7 @@ void DerivationGoal::registerOutputs() else assert(worker.store.parseStorePath(path) == dest); - ca = ContentAddress { + ca = StorePathDescriptor { .name = std::string { i.second.path.name() }, .info = FixedOutputInfo { { @@ -3847,7 +3847,7 @@ void DerivationGoal::registerOutputs() } auto info = ca - ? ValidPathInfo { worker.store, ContentAddress { *ca } } + ? ValidPathInfo { worker.store, StorePathDescriptor { *ca } } : ValidPathInfo { worker.store.parseStorePath(path) }; info.narHash = hash.first; info.narSize = hash.second; @@ -4281,7 +4281,7 @@ class SubstitutionGoal : public Goal private: /* The store path that should be realised through a substitute. */ - // TODO std::variant storePath; + // TODO std::variant storePath; StorePath storePath; /* The remaining substituters. */ @@ -4319,10 +4319,10 @@ class SubstitutionGoal : public Goal /* Content address for recomputing store path */ // TODO delete once `storePath` is variant. - std::optional ca; + std::optional ca; public: - SubstitutionGoal(const StorePath & storePath, Worker & worker, RepairFlag repair = NoRepair, std::optional ca = std::nullopt); + SubstitutionGoal(const StorePath & storePath, Worker & worker, RepairFlag repair = NoRepair, std::optional ca = std::nullopt); ~SubstitutionGoal(); void timedOut(Error && ex) override { abort(); }; @@ -4352,7 +4352,7 @@ class SubstitutionGoal : public Goal }; -SubstitutionGoal::SubstitutionGoal(const StorePath & storePath, Worker & worker, RepairFlag repair, std::optional ca) +SubstitutionGoal::SubstitutionGoal(const StorePath & storePath, Worker & worker, RepairFlag repair, std::optional ca) : Goal(worker) , storePath(storePath) , repair(repair) @@ -4699,7 +4699,7 @@ std::shared_ptr Worker::makeBasicDerivationGoal(const StorePath } -GoalPtr Worker::makeSubstitutionGoal(const StorePath & path, RepairFlag repair, std::optional ca) +GoalPtr Worker::makeSubstitutionGoal(const StorePath & path, RepairFlag repair, std::optional ca) { GoalPtr goal = substitutionGoals[path].lock(); // FIXME if (!goal) { diff --git a/src/libstore/content-address.hh b/src/libstore/content-address.hh index 84ff71a344f..10a5fcf6657 100644 --- a/src/libstore/content-address.hh +++ b/src/libstore/content-address.hh @@ -116,14 +116,14 @@ struct FixedOutputInfo : FixedOutputHash { PathReferences references; }; -struct ContentAddress { +struct StorePathDescriptor { std::string name; std::variant< TextInfo, FixedOutputInfo > info; - bool operator < (const ContentAddress & other) const + bool operator < (const StorePathDescriptor & other) const { return name < other.name; } diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index cb0aa282cfb..10e842d8b74 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -620,7 +620,7 @@ static void performOp(TunnelLogger * logger, ref store, case wopQuerySubstitutablePathInfos: { SubstitutablePathInfos infos; auto paths = readStorePaths(*store, from); - std::set caPaths; + std::set caPaths; if (GET_PROTOCOL_MINOR(clientVersion) > 22) caPaths = readContentAddressSet(*store, from); logger->startWork(); diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index c0ac1da03a5..173e97bed59 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -848,7 +848,7 @@ StorePathSet LocalStore::querySubstitutablePaths(const StorePathSet & paths) } -void LocalStore::querySubstitutablePathInfos(const StorePathSet & paths, const std::set & caPaths, SubstitutablePathInfos & infos) +void LocalStore::querySubstitutablePathInfos(const StorePathSet & paths, const std::set & caPaths, SubstitutablePathInfos & infos) { if (!settings.useSubstitutes) return; diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index f835c1a9fa0..a4fbd65d5de 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -140,7 +140,7 @@ public: StorePathSet querySubstitutablePaths(const StorePathSet & paths) override; void querySubstitutablePathInfos(const StorePathSet & paths, - const std::set & caPaths, + const std::set & caPaths, SubstitutablePathInfos & infos) override; void addToStore(const ValidPathInfo & info, Source & source, diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index ece38fc7b2d..13823a933c3 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -107,11 +107,11 @@ void Store::computeFSClosure(const StorePath & startPath, } -std::optional getDerivationCA(const BasicDerivation & drv) +std::optional getDerivationCA(const BasicDerivation & drv) { auto out = drv.outputs.find("out"); if (out != drv.outputs.end() && out->second.hash) { - return ContentAddress { + return StorePathDescriptor { .name = std::string { out->second.path.name() }, .info = FixedOutputInfo { *out->second.hash, {} }, }; diff --git a/src/libstore/path-info.hh b/src/libstore/path-info.hh index c702c60f55c..febc3e6fe65 100644 --- a/src/libstore/path-info.hh +++ b/src/libstore/path-info.hh @@ -72,7 +72,7 @@ struct ValidPathInfo : PathReferences void sign(const Store & store, const SecretKey & secretKey); - std::optional fullContentAddressOpt() const; + std::optional fullContentAddressOpt() const; /* Return true iff the path is verifiably content-addressed. */ bool isContentAddressed(const Store & store) const; @@ -101,7 +101,7 @@ struct ValidPathInfo : PathReferences ValidPathInfo(const StorePath & path) : path(path) { }; ValidPathInfo(const Store & store, - ContentAddress && ca); + StorePathDescriptor && ca); virtual ~ValidPathInfo() { } }; diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 443c9c45a7b..27de5c28456 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -39,9 +39,9 @@ void writeStorePaths(const Store & store, Sink & out, const StorePathSet & paths out << store.printStorePath(i); } -std::set readContentAddressSet(const Store & store, Source & from) +std::set readContentAddressSet(const Store & store, Source & from) { - std::set paths; + std::set paths; // TODO // auto count = readNum(from); // while (count--) @@ -49,7 +49,7 @@ std::set readContentAddressSet(const Store & store, Source & fro return paths; } -void writeContentAddressSet(const Store & store, Sink & out, const std::set & paths) +void writeContentAddressSet(const Store & store, Sink & out, const std::set & paths) { // TODO //out << paths.size(); @@ -352,7 +352,7 @@ StorePathSet RemoteStore::querySubstitutablePaths(const StorePathSet & paths) } -void RemoteStore::querySubstitutablePathInfos(const StorePathSet & paths, const std::set & caPaths, SubstitutablePathInfos & infos) +void RemoteStore::querySubstitutablePathInfos(const StorePathSet & paths, const std::set & caPaths, SubstitutablePathInfos & infos) { if (paths.empty() && caPaths.empty()) return; diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index a2da5a0fc4a..be931dabab0 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -57,7 +57,7 @@ public: StorePathSet querySubstitutablePaths(const StorePathSet & paths) override; void querySubstitutablePathInfos(const StorePathSet & paths, - const std::set & caPaths, + const std::set & caPaths, SubstitutablePathInfos & infos) override; void addToStore(const ValidPathInfo & info, Source & nar, diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 4928a16f6c5..5f7375abee2 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -205,7 +205,7 @@ StorePath Store::makeTextPath(std::string_view name, const TextInfo & info) cons template struct overloaded : Ts... { using Ts::operator()...; }; template overloaded(Ts...) -> overloaded; -StorePath Store::makeFixedOutputPathFromCA(const ContentAddress & info) const +StorePath Store::makeFixedOutputPathFromCA(const StorePathDescriptor & info) const { // New template return std::visit(overloaded { @@ -843,12 +843,12 @@ void ValidPathInfo::sign(const Store & store, const SecretKey & secretKey) sigs.insert(secretKey.signDetached(fingerprint(store))); } -std::optional ValidPathInfo::fullContentAddressOpt() const +std::optional ValidPathInfo::fullContentAddressOpt() const { if (! ca) return std::nullopt; - return ContentAddress { + return StorePathDescriptor { .name = std::string { path.name() }, .info = std::visit(overloaded { [&](TextHash th) { @@ -913,7 +913,7 @@ Strings ValidPathInfo::shortRefs() const ValidPathInfo::ValidPathInfo( const Store & store, - ContentAddress && info) + StorePathDescriptor && info) : path(store.makeFixedOutputPathFromCA(info)) { std::visit(overloaded { diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 37b75e73052..6f08151a9bf 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -254,7 +254,7 @@ public: StorePath makeTextPath(std::string_view name, const TextInfo & info) const; - StorePath makeFixedOutputPathFromCA(const ContentAddress & info) const; + StorePath makeFixedOutputPathFromCA(const StorePathDescriptor & info) const; /* This is the preparatory part of addToStore(); it computes the store path to which srcPath is to be copied. Returns the store @@ -347,7 +347,7 @@ public: does not have substitute info, it's omitted from the resulting ‘infos’ map. */ virtual void querySubstitutablePathInfos(const StorePathSet & paths, - const std::set & caPaths, + const std::set & caPaths, SubstitutablePathInfos & infos) { return; }; /* Import a path into the store. */ @@ -749,6 +749,6 @@ std::optional decodeValidPathInfo( /* Split URI into protocol+hierarchy part and its parameter set. */ std::pair splitUriAndParams(const std::string & uri); -std::optional getDerivationCA(const BasicDerivation & drv); +std::optional getDerivationCA(const BasicDerivation & drv); } diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index 0b6816abb42..cdb9b9be4e6 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -70,9 +70,9 @@ template T readStorePaths(const Store & store, Source & from); void writeStorePaths(const Store & store, Sink & out, const StorePathSet & paths); -std::set readContentAddressSet(const Store & store, Source & from); +std::set readContentAddressSet(const Store & store, Source & from); -void writeContentAddressSet(const Store & store, Sink & out, const std::set & paths); +void writeContentAddressSet(const Store & store, Sink & out, const std::set & paths); void writeOutputPathMap(const Store & store, Sink & out, const OutputPathMap & paths); diff --git a/src/nix/add-to-store.cc b/src/nix/add-to-store.cc index 1ebe38344f2..b9aa8dd162f 100644 --- a/src/nix/add-to-store.cc +++ b/src/nix/add-to-store.cc @@ -69,7 +69,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand ValidPathInfo info { *store, - ContentAddress { + StorePathDescriptor { .name = *namePart, .info = FixedOutputInfo { { diff --git a/src/nix/make-content-addressable.cc b/src/nix/make-content-addressable.cc index 7e3c0ee4e05..028c0f1442d 100644 --- a/src/nix/make-content-addressable.cc +++ b/src/nix/make-content-addressable.cc @@ -75,7 +75,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON ValidPathInfo info { *store, - ContentAddress { + StorePathDescriptor { .name = std::string { path.name() }, .info = FixedOutputInfo { {