4#include "signature/local-keys.hh"
18 using StoreConfig::StoreConfig;
21 "NAR compression method (`xz`, `bzip2`, `gzip`, `zstd`, or `none`)."};
23 const Setting<bool> writeNARListing{
this,
false,
"write-nar-listing",
24 "Whether to write a JSON file that lists the files in each NAR."};
26 const Setting<bool> writeDebugInfo{
this,
false,
"index-debug-info",
28 Whether to index DWARF debug info files by build ID. This allows [`dwarffs`](https://github.com/edolstra/dwarffs) to
29 fetch debug info on demand
33 "Path to the secret key used to sign the binary cache."};
35 const Setting<Path> localNarCache{
this,
"",
"local-nar-cache",
36 "Path to a local cache of NARs fetched from this binary cache, used by commands such as `nix store cat`."};
38 const Setting<bool> parallelCompression{
this,
false,
"parallel-compression",
39 "Enable multi-threaded compression of NARs. This is currently only available for `xz` and `zstd`."};
41 const Setting<int> compressionLevel{
this, -1,
"compression-level",
43 The *preset level* to be used when compressing NARs.
44 The meaning and accepted values depend on the compression method selected.
45 `-1` specifies that the default compression level should be used.
60 std::unique_ptr<Signer> signer;
65 const std::string realisationsPrefix =
"realisations";
67 const std::string cacheInfoFile =
"nix-cache-info";
69 BinaryCacheStore(
const Params & params);
73 virtual bool fileExists(
const std::string & path) = 0;
75 virtual void upsertFile(
const std::string & path,
76 std::shared_ptr<std::basic_iostream<char>>
istream,
77 const std::string & mimeType) = 0;
79 void upsertFile(
const std::string & path,
82 const std::string & mimeType);
87 virtual void getFile(
const std::string & path,
Sink & sink);
100 const std::string & path,
101 Callback<std::optional<std::string>> callback)
noexcept;
103 std::optional<std::string>
getFile(
const std::string & path);
107 virtual void init()
override;
111 std::string narMagic;
113 std::string narInfoFileFor(
const StorePath & storePath);
118 Source & narSource, RepairFlag
repair, CheckSigsFlag checkSigs,
123 bool isValidPathUncached(
const StorePath & path)
override;
125 void queryPathInfoUncached(
const StorePath & path,
126 Callback<std::shared_ptr<const ValidPathInfo>> callback)
noexcept override;
131 RepairFlag
repair, CheckSigsFlag checkSigs)
override;
135 std::string_view
name,
138 HashAlgorithm hashAlgo,
139 const StorePathSet & references,
140 RepairFlag
repair)
override;
143 std::string_view
name,
146 HashAlgorithm hashAlgo,
147 const StorePathSet & references,
149 RepairFlag
repair)
override;
153 void queryRealisationUncached(
const DrvOutput &,
154 Callback<std::shared_ptr<const Realisation>> callback)
noexcept override;
162 std::optional<std::string> getBuildLogExact(
const StorePath & path)
override;
164 void addBuildLog(
const StorePath & drvPath, std::string_view log)
override;
168MakeError(NoSuchBinaryCacheFile, Error);
StorePath addToStoreFromDump(Source &dump, std::string_view name, FileSerialisationMethod dumpMethod, ContentAddressMethod hashMethod, HashAlgorithm hashAlgo, const StorePathSet &references, RepairFlag repair) override
Definition binary-cache-store.cc:301
std::optional< StorePath > queryPathFromHashPart(const std::string &hashPart) override
Definition binary-cache-store.cc:382
ref< SourceAccessor > getFSAccessor(bool requireValidPath=true) override
Definition binary-cache-store.cc:516
void addSignatures(const StorePath &storePath, const StringSet &sigs) override
Definition binary-cache-store.cc:521
void narFromPath(const StorePath &path, Sink &sink) override
Definition binary-cache-store.cc:393
void registerDrvOutput(const Realisation &info) override
Definition binary-cache-store.cc:509
virtual void init() override
Definition binary-cache-store.cc:40
virtual void getFile(const std::string &path, Sink &sink)
Definition binary-cache-store.cc:84
virtual std::optional< std::string > getNixCacheInfo()
Definition binary-cache-store.cc:64
void addToStore(const ValidPathInfo &info, Source &narSource, RepairFlag repair, CheckSigsFlag checkSigs) override
Definition binary-cache-store.cc:283
Definition callback.hh:17
FileSerialisationMethod
Definition file-content-address.hh:20
std::function< bool(const Path &path)> PathFilter
Definition file-system.hh:365
std::shared_ptr< std::basic_istream< char > > istream
Definition lexer.l:3574
std::variant< std::string, std::string_view > data
Definition lexer.l:177
RepairFlag repair
Definition lexer.l:7173
std::pair< Hash, uint64_t > HashResult
Definition hash.hh:174
Definition binary-cache-store.hh:17
Definition content-address.hh:31
Definition realisation.hh:24
Definition log-store.hh:10
Definition nar-info.hh:13
Definition realisation.hh:49
Definition serialise.hh:20
Definition source-path.hh:22
Definition serialise.hh:68
virtual const std::string name()=0
Definition path-info.hh:130