17struct BinaryCacheStoreConfig :
virtual StoreConfig
20 void anchor()
override;
23 BinaryCacheStoreConfig(
const Params & params)
33 NAR compression method. One of: `xz`, `bzip2`, `gzip`, `zstd`, `none`, `br`, `compress`, `grzip`, `lrzip`, `lz4`, `lzip`, `lzma` or `lzop`.
34 To use a particular compression method Nix has to be built with a version of libarchive that natively supports that compression algorithm.
38 this,
false,
"write-nar-listing",
"Whether to write a JSON file that lists the files in each NAR."};
45 Whether to index DWARF debug info files by build ID. This allows [`dwarffs`](https://github.com/edolstra/dwarffs) to
46 fetch debug info on demand
50 this, std::nullopt,
"secret-key",
"Path to the secret key used to sign the binary cache."};
53 this,
"",
"secret-keys",
"List of comma-separated paths to the secret keys used to sign the binary cache."};
59 "Path to a local cache of NARs fetched from this binary cache, used by commands such as `nix store cat`."};
64 "parallel-compression",
66 Enable multi-threaded compression of NARs. This is currently only available for `xz` and `zstd`.
68 If not set explicitly, defaults to `true` when `compression` is `zstd` and `false` otherwise.
76 The *preset level* to be used when compressing NARs.
77 The meaning and accepted values depend on the compression method selected.
78 `-1` specifies that the default compression level should be used.
87 BinaryCacheStore :
virtual Store,
99 void anchor()
override;
101 std::vector<std::unique_ptr<Signer>> signers;
120 constexpr static const std::string cacheInfoFile =
"nix-cache-info";
122 BinaryCacheStore(Config &);
133 virtual bool fileExists(
const std::string & path) = 0;
135 virtual void upsertFile(
136 const std::string & path,
RestartableSource & source,
const std::string & mimeType, uint64_t sizeHint) = 0;
139 const std::string & path,
142 const std::string & mimeType,
146 const std::string & path,
149 const std::string & mimeType)
151 auto size = data.size();
152 upsertFile(path, std::move(data), mimeType, size);
158 virtual void getFile(
const std::string & path,
Sink & sink);
170 virtual void getFile(
const std::string & path,
Callback<std::optional<std::string>> callback)
noexcept;
172 std::optional<std::string>
getFile(
const std::string & path);
176 virtual void init()
override;
180 std::string narMagic;
182 std::string narInfoFileFor(
const StorePath & storePath);
213 bool isValidPathUncached(
const StorePath & path)
override;
215 void queryPathInfoUncached(
216 const StorePath & path,
Callback<std::shared_ptr<const ValidPathInfo>> callback)
noexcept override;
228 std::string_view name,
231 HashAlgorithm hashAlgo,
232 const StorePathSet & references,
233 RepairFlag repair)
override;
236 std::string_view name,
239 HashAlgorithm hashAlgo,
240 const StorePathSet & references,
242 RepairFlag repair)
override;
246 void queryRealisationUncached(
247 const DrvOutput &,
Callback<std::shared_ptr<const UnkeyedRealisation>> callback)
noexcept override;
257 std::optional<std::string> getBuildLogExact(
const StorePath & path)
override;
259 void addBuildLog(
const StorePath & drvPath, std::string_view log)
override;
262MakeError(NoSuchBinaryCacheFile, Error);
Definition callback.hh:19
Definition remote-fs-accessor.hh:12
Definition serialise.hh:183
Definition configuration.hh:476
std::vector< std::pair< ValidPathInfo, std::unique_ptr< Source > > > PathsSource
Definition store-api.hh:680
FileSerialisationMethod
Definition file-content-address.hh:20
fun< bool(const std::string &path)> PathFilter
Definition file-system.hh:494
Definition logging.hh:221
Definition binary-cache-store.hh:18
Config & config
Definition binary-cache-store.hh:96
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:451
void registerDrvOutputUnchecked(const Realisation &info) override
Definition binary-cache-store.cc:682
void addMultipleToStore(PathsSource &&pathsToCopy, Activity &act, RepairFlag repair, CheckSigsFlag checkSigs) override
Definition binary-cache-store.cc:320
std::optional< StorePath > queryPathFromHashPart(const std::string &hashPart) override
Definition binary-cache-store.cc:534
ref< SourceAccessor > getFSAccessor(bool requireValidPath=true) override
Definition binary-cache-store.cc:697
void addSignatures(const StorePath &storePath, const std::set< Signature > &sigs) override
Definition binary-cache-store.cc:707
void narFromPath(const StorePath &path, Sink &sink) override
Definition binary-cache-store.cc:545
std::string makeRealisationPath(const DrvOutput &id)
Definition binary-cache-store.cc:644
virtual void init() override
Definition binary-cache-store.cc:53
static constexpr const std::string realisationsPrefix
Definition binary-cache-store.hh:118
virtual void getFile(const std::string &path, Sink &sink)
Definition binary-cache-store.cc:102
virtual std::optional< std::string > getNixCacheInfo()
Definition binary-cache-store.cc:81
void addToStore(const ValidPathInfo &info, Source &narSource, RepairFlag repair, CheckSigsFlag checkSigs) override
Definition binary-cache-store.cc:305
Definition content-address.hh:32
Definition realisation.hh:26
Definition log-store.hh:9
Definition nar-info.hh:38
Definition realisation.hh:103
Definition serialise.hh:18
Definition source-path.hh:22
Definition serialise.hh:95
@ Unix
Definition store-api.hh:131
Definition path-info.hh:159