about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/binary-cache-store.hh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libstore/binary-cache-store.hh')
-rw-r--r--third_party/nix/src/libstore/binary-cache-store.hh148
1 files changed, 73 insertions, 75 deletions
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 <atomic>
 #include "crypto.hh"
-#include "store-api.hh"
-
 #include "pool.hh"
-
-#include <atomic>
+#include "store-api.hh"
 
 namespace nix {
 
 struct NarInfo;
 
-class BinaryCacheStore : public Store
-{
-public:
-
-    const Setting<std::string> compression{this, "xz", "compression", "NAR compression method ('xz', 'bzip2', or 'none')"};
-    const Setting<bool> writeNARListing{this, false, "write-nar-listing", "whether to write a JSON file listing the files in each NAR"};
-    const Setting<Path> secretKeyFile{this, "", "secret-key", "path to secret key used to sign the binary cache"};
-    const Setting<Path> localNarCache{this, "", "local-nar-cache", "path to a local cache of NARs"};
-    const Setting<bool> parallelCompression{this, false, "parallel-compression",
-        "enable multi-threading compression, available for xz only currently"};
-
-private:
-
-    std::unique_ptr<SecretKey> 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<std::string> compression{
+      this, "xz", "compression",
+      "NAR compression method ('xz', 'bzip2', or 'none')"};
+  const Setting<bool> writeNARListing{
+      this, false, "write-nar-listing",
+      "whether to write a JSON file listing the files in each NAR"};
+  const Setting<Path> secretKeyFile{
+      this, "", "secret-key",
+      "path to secret key used to sign the binary cache"};
+  const Setting<Path> localNarCache{this, "", "local-nar-cache",
+                                    "path to a local cache of NARs"};
+  const Setting<bool> 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> 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<std::shared_ptr<std::string>> callback) noexcept;
+ protected:
+  BinaryCacheStore(const Params& params);
 
-    std::shared_ptr<std::string> 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<std::shared_ptr<std::string>> callback) noexcept;
 
-private:
+  std::shared_ptr<std::string> 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> narInfo);
+ private:
+  std::string narMagic;
 
-public:
+  std::string narInfoFileFor(const Path& storePath);
 
-    bool isValidPathUncached(const Path & path) override;
+  void writeNarInfo(ref<NarInfo> narInfo);
 
-    void queryPathInfoUncached(const Path & path,
-        Callback<std::shared_ptr<ValidPathInfo>> callback) noexcept override;
+ public:
+  bool isValidPathUncached(const Path& path) override;
 
-    Path queryPathFromHashPart(const string & hashPart) override
-    { unsupported("queryPathFromHashPart"); }
+  void queryPathInfoUncached(
+      const Path& path,
+      Callback<std::shared_ptr<ValidPathInfo>> callback) noexcept override;
 
-    bool wantMassQuery() override { return wantMassQuery_; }
+  Path queryPathFromHashPart(const string& hashPart) override {
+    unsupported("queryPathFromHashPart");
+  }
 
-    void addToStore(const ValidPathInfo & info, const ref<std::string> & nar,
-        RepairFlag repair, CheckSigsFlag checkSigs,
-        std::shared_ptr<FSAccessor> 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<std::string>& 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,
+                  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<FSAccessor> getFSAccessor() override;
+  void ensurePath(const Path& path) override { unsupported("ensurePath"); }
 
-    void addSignatures(const Path & storePath, const StringSet & sigs) override;
+  ref<FSAccessor> getFSAccessor() override;
 
-    std::shared_ptr<std::string> getBuildLog(const Path & path) override;
+  void addSignatures(const Path& storePath, const StringSet& sigs) override;
 
-    int getPriority() override { return priority; }
+  std::shared_ptr<std::string> getBuildLog(const Path& path) override;
 
+  int getPriority() override { return priority; }
 };
 
 MakeError(NoSuchBinaryCacheFile, Error);
 
-}
+}  // namespace nix