20 using StoreConfig::StoreConfig;
23 "NAR compression method (`xz`, `bzip2`, `gzip`, `zstd`, or `none`)."};
25 const Setting<bool> writeNARListing{
this,
false,
"write-nar-listing",
26 "Whether to write a JSON file that lists the files in each NAR."};
28 const Setting<bool> writeDebugInfo{
this,
false,
"index-debug-info",
30 Whether to index DWARF debug info files by build ID. This allows [`dwarffs`](https://github.com/edolstra/dwarffs) to
31 fetch debug info on demand
35 "Path to the secret key used to sign the binary cache."};
37 const Setting<Path> localNarCache{
this,
"",
"local-nar-cache",
38 "Path to a local cache of NARs fetched from this binary cache, used by commands such as `nix store cat`."};
40 const Setting<bool> parallelCompression{
this,
false,
"parallel-compression",
41 "Enable multi-threaded compression of NARs. This is currently only available for `xz` and `zstd`."};
43 const Setting<int> compressionLevel{
this, -1,
"compression-level",
45 The *preset level* to be used when compressing NARs.
46 The meaning and accepted values depend on the compression method selected.
47 `-1` specifies that the default compression level should be used.
56class BinaryCacheStore :
public virtual Store,
62 std::unique_ptr<SecretKey> secretKey;
67 const std::string realisationsPrefix =
"realisations";
76 virtual bool fileExists(
const std::string & path) = 0;
78 virtual void upsertFile(
const std::string & path,
79 std::shared_ptr<std::basic_iostream<char>> istream,
80 const std::string & mimeType) = 0;
82 void upsertFile(
const std::string & path,
85 const std::string & mimeType);
92 virtual std::optional<std::string> getFileContents(
const std::string & path);
96 virtual kj::Promise<Result<void>>
init()
override;
100 std::string narMagic;
102 std::string narInfoFileFor(
const StorePath & storePath);
104 kj::Promise<Result<void>> writeNarInfo(
ref<NarInfo> narInfo);
106 kj::Promise<Result<ref<const ValidPathInfo>>> addToStoreCommon(
112 kj::Promise<Result<bool>> isValidPathUncached(
const StorePath & path)
override;
114 kj::Promise<Result<std::shared_ptr<const ValidPathInfo>>>
117 kj::Promise<Result<std::optional<StorePath>>>
121 RepairFlag repair, CheckSigsFlag checkSigs)
override;
125 std::string_view name,
129 const StorePathSet & references
133 std::string_view name,
136 RepairFlag repair)
override;
137 kj::Promise<Result<StorePath>> addToStoreFlat(
138 std::string_view name,
139 const Path & srcPath,
141 RepairFlag repair)
override;
144 std::string_view name,
146 const StorePathSet & references,
147 RepairFlag repair)
override;
151 kj::Promise<Result<std::shared_ptr<const Realisation>>>
152 queryRealisationUncached(
const DrvOutput &)
override;
158 kj::Promise<Result<void>>
161 kj::Promise<Result<std::optional<std::string>>> getBuildLogExact(
const StorePath & path)
override;
163 kj::Promise<Result<void>> addBuildLog(
const StorePath & drvPath, std::string_view log)
override;
167MakeError(NoSuchBinaryCacheFile, Error);
kj::Promise< Result< StorePath > > addToStoreFromDump(AsyncInputStream &dump, std::string_view name, FileIngestionMethod method, HashType hashAlgo, RepairFlag repair, const StorePathSet &references) override
Definition binary-cache-store.cc:296
virtual box_ptr< Source > getFile(const std::string &path)=0
kj::Promise< Result< StorePath > > addTextToStore(std::string_view name, std::string_view s, const StorePathSet &references, RepairFlag repair) override
Definition binary-cache-store.cc:476
kj::Promise< Result< StorePath > > addToStoreRecursive(std::string_view name, const PreparedDump &source, HashType hashAlgo, RepairFlag repair) override
Definition binary-cache-store.cc:432
kj::Promise< Result< std::optional< StorePath > > > queryPathFromHashPart(const std::string &hashPart) override
Definition binary-cache-store.cc:340
kj::Promise< Result< void > > addSignatures(const StorePath &storePath, const StringSet &sigs) override
Definition binary-cache-store.cc:540
ref< FSAccessor > getFSAccessor() override
Definition binary-cache-store.cc:534
kj::Promise< Result< void > > registerDrvOutput(const Realisation &info) override
Definition binary-cache-store.cc:523
virtual kj::Promise< Result< void > > init() override
Definition binary-cache-store.cc:37
kj::Promise< Result< box_ptr< Source > > > narFromPath(const StorePath &path) override
Definition binary-cache-store.cc:353
kj::Promise< Result< std::shared_ptr< const ValidPathInfo > > > queryPathInfoUncached(const StorePath &path) override
Definition binary-cache-store.cc:389
kj::Promise< Result< void > > addToStore(const ValidPathInfo &info, AsyncInputStream &narSource, RepairFlag repair, CheckSigsFlag checkSigs) override
Definition binary-cache-store.cc:271
FileIngestionMethod
Definition content-address.hh:38
std::pair< Hash, uint64_t > HashResult
Definition hash.hh:167
Definition binary-cache-store.hh:19
Definition realisation.hh:24
Definition log-store.hh:10
Definition nar-info.hh:13
Definition realisation.hh:49
Definition path-info.hh:83
std::string Path
Definition types.hh:28