about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/remote-store.hh
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-17T15·31+0100
committerVincent Ambo <tazjin@google.com>2020-05-17T15·31+0100
commit0f2cf531f705d370321843e5ba9135b2ebdb5d19 (patch)
tree256feb13963a849ed96e89228fa05454c2a22363 /third_party/nix/src/libstore/remote-store.hh
parent65a1aae98ce5a237c9643e639e550c8b0c0be7f1 (diff)
style(3p/nix): Reformat project in Google C++ style r/740
Reformatted with:

    fd . -e hh -e cc | xargs clang-format -i
Diffstat (limited to 'third_party/nix/src/libstore/remote-store.hh')
-rw-r--r--third_party/nix/src/libstore/remote-store.hh179
1 files changed, 85 insertions, 94 deletions
diff --git a/third_party/nix/src/libstore/remote-store.hh b/third_party/nix/src/libstore/remote-store.hh
index 1f375dd71520..dd37b83f84a5 100644
--- a/third_party/nix/src/libstore/remote-store.hh
+++ b/third_party/nix/src/libstore/remote-store.hh
@@ -2,160 +2,151 @@
 
 #include <limits>
 #include <string>
-
 #include "store-api.hh"
 
-
 namespace nix {
 
-
 class Pipe;
 class Pid;
 struct FdSink;
 struct FdSource;
-template<typename T> class Pool;
+template <typename T>
+class Pool;
 struct ConnectionHandle;
 
-
 /* FIXME: RemoteStore is a misnomer - should be something like
    DaemonStore. */
-class RemoteStore : public virtual Store
-{
-public:
-
-    const Setting<int> maxConnections{(Store*) this, 1,
-            "max-connections", "maximum number of concurrent connections to the Nix daemon"};
-
-    const Setting<unsigned int> maxConnectionAge{(Store*) this, std::numeric_limits<unsigned int>::max(),
-            "max-connection-age", "number of seconds to reuse a connection"};
+class RemoteStore : public virtual Store {
+ public:
+  const Setting<int> maxConnections{
+      (Store*)this, 1, "max-connections",
+      "maximum number of concurrent connections to the Nix daemon"};
 
-    virtual bool sameMachine() = 0;
+  const Setting<unsigned int> maxConnectionAge{
+      (Store*)this, std::numeric_limits<unsigned int>::max(),
+      "max-connection-age", "number of seconds to reuse a connection"};
 
-    RemoteStore(const Params & params);
+  virtual bool sameMachine() = 0;
 
-    /* Implementations of abstract store API methods. */
+  RemoteStore(const Params& params);
 
-    bool isValidPathUncached(const Path & path) override;
+  /* Implementations of abstract store API methods. */
 
-    PathSet queryValidPaths(const PathSet & paths,
-        SubstituteFlag maybeSubstitute = NoSubstitute) override;
+  bool isValidPathUncached(const Path& path) override;
 
-    PathSet queryAllValidPaths() override;
+  PathSet queryValidPaths(const PathSet& paths, SubstituteFlag maybeSubstitute =
+                                                    NoSubstitute) override;
 
-    void queryPathInfoUncached(const Path & path,
-        Callback<std::shared_ptr<ValidPathInfo>> callback) noexcept override;
+  PathSet queryAllValidPaths() override;
 
-    void queryReferrers(const Path & path, PathSet & referrers) override;
+  void queryPathInfoUncached(
+      const Path& path,
+      Callback<std::shared_ptr<ValidPathInfo>> callback) noexcept override;
 
-    PathSet queryValidDerivers(const Path & path) override;
+  void queryReferrers(const Path& path, PathSet& referrers) override;
 
-    PathSet queryDerivationOutputs(const Path & path) override;
+  PathSet queryValidDerivers(const Path& path) override;
 
-    StringSet queryDerivationOutputNames(const Path & path) override;
+  PathSet queryDerivationOutputs(const Path& path) override;
 
-    Path queryPathFromHashPart(const string & hashPart) override;
+  StringSet queryDerivationOutputNames(const Path& path) override;
 
-    PathSet querySubstitutablePaths(const PathSet & paths) override;
+  Path queryPathFromHashPart(const string& hashPart) override;
 
-    void querySubstitutablePathInfos(const PathSet & paths,
-        SubstitutablePathInfos & infos) override;
+  PathSet querySubstitutablePaths(const PathSet& paths) override;
 
-    void addToStore(const ValidPathInfo & info, Source & nar,
-        RepairFlag repair, CheckSigsFlag checkSigs,
-        std::shared_ptr<FSAccessor> accessor) override;
+  void querySubstitutablePathInfos(const PathSet& paths,
+                                   SubstitutablePathInfos& infos) override;
 
-    Path addToStore(const string & name, const Path & srcPath,
-        bool recursive = true, HashType hashAlgo = htSHA256,
-        PathFilter & filter = defaultPathFilter, RepairFlag repair = NoRepair) override;
+  void addToStore(const ValidPathInfo& info, Source& nar, RepairFlag repair,
+                  CheckSigsFlag checkSigs,
+                  std::shared_ptr<FSAccessor> 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 = true, HashType hashAlgo = htSHA256,
+                  PathFilter& filter = defaultPathFilter,
+                  RepairFlag repair = NoRepair) override;
 
-    void buildPaths(const PathSet & paths, BuildMode buildMode) 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;
+  void buildPaths(const PathSet& paths, BuildMode buildMode) override;
 
-    void ensurePath(const Path & path) override;
+  BuildResult buildDerivation(const Path& drvPath, const BasicDerivation& drv,
+                              BuildMode buildMode) override;
 
-    void addTempRoot(const Path & path) override;
+  void ensurePath(const Path& path) override;
 
-    void addIndirectRoot(const Path & path) override;
+  void addTempRoot(const Path& path) override;
 
-    void syncWithGC() override;
+  void addIndirectRoot(const Path& path) override;
 
-    Roots findRoots(bool censor) override;
+  void syncWithGC() override;
 
-    void collectGarbage(const GCOptions & options, GCResults & results) override;
+  Roots findRoots(bool censor) override;
 
-    void optimiseStore() override;
+  void collectGarbage(const GCOptions& options, GCResults& results) override;
 
-    bool verifyStore(bool checkContents, RepairFlag repair) override;
+  void optimiseStore() override;
 
-    void addSignatures(const Path & storePath, const StringSet & sigs) override;
+  bool verifyStore(bool checkContents, RepairFlag repair) override;
 
-    void queryMissing(const PathSet & targets,
-        PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown,
-        unsigned long long & downloadSize, unsigned long long & narSize) override;
+  void addSignatures(const Path& storePath, const StringSet& sigs) override;
 
-    void connect() override;
+  void queryMissing(const PathSet& targets, PathSet& willBuild,
+                    PathSet& willSubstitute, PathSet& unknown,
+                    unsigned long long& downloadSize,
+                    unsigned long long& narSize) override;
 
-    unsigned int getProtocol() override;
+  void connect() override;
 
-    void flushBadConnections();
+  unsigned int getProtocol() override;
 
-protected:
+  void flushBadConnections();
 
-    struct Connection
-    {
-        AutoCloseFD fd;
-        FdSink to;
-        FdSource from;
-        unsigned int daemonVersion;
-        std::chrono::time_point<std::chrono::steady_clock> startTime;
+ protected:
+  struct Connection {
+    AutoCloseFD fd;
+    FdSink to;
+    FdSource from;
+    unsigned int daemonVersion;
+    std::chrono::time_point<std::chrono::steady_clock> startTime;
 
-        virtual ~Connection();
+    virtual ~Connection();
 
-        std::exception_ptr processStderr(Sink * sink = 0, Source * source = 0);
-    };
+    std::exception_ptr processStderr(Sink* sink = 0, Source* source = 0);
+  };
 
-    ref<Connection> openConnectionWrapper();
+  ref<Connection> openConnectionWrapper();
 
-    virtual ref<Connection> openConnection() = 0;
+  virtual ref<Connection> openConnection() = 0;
 
-    void initConnection(Connection & conn);
+  void initConnection(Connection& conn);
 
-    ref<Pool<Connection>> connections;
+  ref<Pool<Connection>> connections;
 
-    virtual void setOptions(Connection & conn);
+  virtual void setOptions(Connection& conn);
 
-    ConnectionHandle getConnection();
+  ConnectionHandle getConnection();
 
-    friend struct ConnectionHandle;
-
-private:
-
-    std::atomic_bool failed{false};
+  friend struct ConnectionHandle;
 
+ private:
+  std::atomic_bool failed{false};
 };
 
-class UDSRemoteStore : public LocalFSStore, public RemoteStore
-{
-public:
-
-    UDSRemoteStore(const Params & params);
-    UDSRemoteStore(std::string path, const Params & params);
+class UDSRemoteStore : public LocalFSStore, public RemoteStore {
+ public:
+  UDSRemoteStore(const Params& params);
+  UDSRemoteStore(std::string path, const Params& params);
 
-    std::string getUri() override;
+  std::string getUri() override;
 
-    bool sameMachine()
-    { return true; }
+  bool sameMachine() { return true; }
 
-private:
-
-    ref<RemoteStore::Connection> openConnection() override;
-    std::optional<std::string> path;
+ private:
+  ref<RemoteStore::Connection> openConnection() override;
+  std::optional<std::string> path;
 };
 
-
-}
+}  // namespace nix