From 0f2cf531f705d370321843e5ba9135b2ebdb5d19 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 17 May 2020 16:31:57 +0100 Subject: style(3p/nix): Reformat project in Google C++ style Reformatted with: fd . -e hh -e cc | xargs clang-format -i --- third_party/nix/src/libstore/binary-cache-store.hh | 148 ++++++++++----------- 1 file changed, 73 insertions(+), 75 deletions(-) (limited to 'third_party/nix/src/libstore/binary-cache-store.hh') diff --git a/third_party/nix/src/libstore/binary-cache-store.hh b/third_party/nix/src/libstore/binary-cache-store.hh index af108880cb..80121aa22e 100644 --- a/third_party/nix/src/libstore/binary-cache-store.hh +++ b/third_party/nix/src/libstore/binary-cache-store.hh @@ -1,115 +1,113 @@ #pragma once +#include #include "crypto.hh" -#include "store-api.hh" - #include "pool.hh" - -#include +#include "store-api.hh" namespace nix { struct NarInfo; -class BinaryCacheStore : public Store -{ -public: - - const Setting compression{this, "xz", "compression", "NAR compression method ('xz', 'bzip2', or 'none')"}; - const Setting writeNARListing{this, false, "write-nar-listing", "whether to write a JSON file listing the files in each NAR"}; - const Setting secretKeyFile{this, "", "secret-key", "path to secret key used to sign the binary cache"}; - const Setting localNarCache{this, "", "local-nar-cache", "path to a local cache of NARs"}; - const Setting parallelCompression{this, false, "parallel-compression", - "enable multi-threading compression, available for xz only currently"}; - -private: - - std::unique_ptr secretKey; - -protected: - - BinaryCacheStore(const Params & params); - -public: - - virtual bool fileExists(const std::string & path) = 0; - - virtual void upsertFile(const std::string & path, - const std::string & data, - const std::string & mimeType) = 0; - - /* Note: subclasses must implement at least one of the two - following getFile() methods. */ +class BinaryCacheStore : public Store { + public: + const Setting compression{ + this, "xz", "compression", + "NAR compression method ('xz', 'bzip2', or 'none')"}; + const Setting writeNARListing{ + this, false, "write-nar-listing", + "whether to write a JSON file listing the files in each NAR"}; + const Setting secretKeyFile{ + this, "", "secret-key", + "path to secret key used to sign the binary cache"}; + const Setting localNarCache{this, "", "local-nar-cache", + "path to a local cache of NARs"}; + const Setting parallelCompression{ + this, false, "parallel-compression", + "enable multi-threading compression, available for xz only currently"}; - /* Dump the contents of the specified file to a sink. */ - virtual void getFile(const std::string & path, Sink & sink); + private: + std::unique_ptr secretKey; - /* Fetch the specified file and call the specified callback with - the result. A subclass may implement this asynchronously. */ - virtual void getFile(const std::string & path, - Callback> callback) noexcept; + protected: + BinaryCacheStore(const Params& params); - std::shared_ptr getFile(const std::string & path); + public: + virtual bool fileExists(const std::string& path) = 0; -protected: + virtual void upsertFile(const std::string& path, const std::string& data, + const std::string& mimeType) = 0; - bool wantMassQuery_ = false; - int priority = 50; + /* Note: subclasses must implement at least one of the two + following getFile() methods. */ -public: + /* Dump the contents of the specified file to a sink. */ + virtual void getFile(const std::string& path, Sink& sink); - virtual void init(); + /* Fetch the specified file and call the specified callback with + the result. A subclass may implement this asynchronously. */ + virtual void getFile( + const std::string& path, + Callback> callback) noexcept; -private: + std::shared_ptr getFile(const std::string& path); - std::string narMagic; + protected: + bool wantMassQuery_ = false; + int priority = 50; - std::string narInfoFileFor(const Path & storePath); + public: + virtual void init(); - void writeNarInfo(ref narInfo); + private: + std::string narMagic; -public: + std::string narInfoFileFor(const Path& storePath); - bool isValidPathUncached(const Path & path) override; + void writeNarInfo(ref narInfo); - void queryPathInfoUncached(const Path & path, - Callback> callback) noexcept override; + public: + bool isValidPathUncached(const Path& path) override; - Path queryPathFromHashPart(const string & hashPart) override - { unsupported("queryPathFromHashPart"); } + void queryPathInfoUncached( + const Path& path, + Callback> callback) noexcept override; - bool wantMassQuery() override { return wantMassQuery_; } + Path queryPathFromHashPart(const string& hashPart) override { + unsupported("queryPathFromHashPart"); + } - void addToStore(const ValidPathInfo & info, const ref & nar, - RepairFlag repair, CheckSigsFlag checkSigs, - std::shared_ptr accessor) override; + bool wantMassQuery() override { return wantMassQuery_; } - Path addToStore(const string & name, const Path & srcPath, - bool recursive, HashType hashAlgo, - PathFilter & filter, RepairFlag repair) override; + void addToStore(const ValidPathInfo& info, const ref& nar, + RepairFlag repair, CheckSigsFlag checkSigs, + std::shared_ptr accessor) override; - Path addTextToStore(const string & name, const string & s, - const PathSet & references, RepairFlag repair) override; + Path addToStore(const string& name, const Path& srcPath, bool recursive, + HashType hashAlgo, PathFilter& filter, + RepairFlag repair) override; - void narFromPath(const Path & path, Sink & sink) override; + Path addTextToStore(const string& name, const string& s, + const PathSet& references, RepairFlag repair) override; - BuildResult buildDerivation(const Path & drvPath, const BasicDerivation & drv, - BuildMode buildMode) override - { unsupported("buildDerivation"); } + void narFromPath(const Path& path, Sink& sink) override; - void ensurePath(const Path & path) override - { unsupported("ensurePath"); } + BuildResult buildDerivation(const Path& drvPath, const BasicDerivation& drv, + BuildMode buildMode) override { + unsupported("buildDerivation"); + } - ref getFSAccessor() override; + void ensurePath(const Path& path) override { unsupported("ensurePath"); } - void addSignatures(const Path & storePath, const StringSet & sigs) override; + ref getFSAccessor() override; - std::shared_ptr getBuildLog(const Path & path) override; + void addSignatures(const Path& storePath, const StringSet& sigs) override; - int getPriority() override { return priority; } + std::shared_ptr getBuildLog(const Path& path) override; + int getPriority() override { return priority; } }; MakeError(NoSuchBinaryCacheFile, Error); -} +} // namespace nix -- cgit 1.4.1