Nix  2.93.0-dev
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
store-api.hh
Go to the documentation of this file.
1#pragma once
3
7#include "lix/libutil/json-fwd.hh"
11#include "lix/libstore/path.hh"
13#include "lix/libutil/hash.hh"
15#include "lix/libutil/result.hh"
18#include "lix/libutil/sync.hh"
20#include "lix/libutil/config.hh"
21#include "lix/libutil/json-fwd.hh"
25
26#include <kj/async.h>
27#include <atomic>
28#include <limits>
29#include <map>
30#include <type_traits>
31#include <unordered_map>
32#include <unordered_set>
33#include <memory>
34#include <string>
35#include <chrono>
36#include <variant>
37
38
39namespace nix {
40
65MakeError(SubstError, Error);
69MakeError(BuildError, Error);
74MakeError(InvalidPath, Error);
75MakeError(Unsupported, Error);
76MakeError(SubstituteGone, Error);
77MakeError(SubstituterDisabled, Error);
82MakeError(BadStorePath, Error);
83
84MakeError(InvalidStoreURI, Error);
85
86struct BasicDerivation;
87struct Derivation;
88class FSAccessor;
90class Store;
91
92
93typedef std::map<std::string, StorePath> OutputPathMap;
94
95
96enum CheckSigsFlag : bool { NoCheckSigs = false, CheckSigs = true };
97enum SubstituteFlag : bool { NoSubstitute = false, Substitute = true };
98enum AllowInvalidFlag : bool { DisallowInvalid = false, AllowInvalid = true };
99
103const uint32_t exportMagic = 0x4558494e;
104
105
106enum BuildMode { bmNormal, bmRepair, bmCheck };
108BuildMode buildModeFromInteger(int);
109
110enum TrustedFlag : bool { NotTrusted = false, Trusted = true };
111
112template<>
113struct json::is_integral_enum<TrustedFlag> : std::true_type {};
114
115struct BuildResult;
116struct KeyedBuildResult;
117
118
119typedef std::map<StorePath, std::optional<ContentAddress>> StorePathCAMap;
120
121struct StoreConfig : public Config
122{
123 typedef std::map<std::string, std::string> Params;
124
125 using Config::Config;
126
127 StoreConfig() = delete;
128
129 static StringSet getDefaultSystemFeatures();
130
131 virtual ~StoreConfig() noexcept(false) { }
132
136 virtual const std::string name() = 0;
137
141 virtual std::string doc()
142 {
143 return "";
144 }
145
150 virtual std::optional<ExperimentalFeature> experimentalFeature() const
151 {
152 return std::nullopt;
153 }
154
155 const PathsSetting<Path> storeDir_{this, settings.nixStore,
156 "store",
157 R"(
158 Logical location of the Nix store, usually
159 `/nix/store`. Note that you can only copy store paths
160 between stores if they have the same `store` setting.
161 )"};
162 const Path storeDir = storeDir_;
163
164 const Setting<int> pathInfoCacheSize{this, 65536, "path-info-cache-size",
165 "Size of the in-memory store path metadata cache."};
166
167 const Setting<bool> isTrusted{this, false, "trusted",
168 R"(
169 Whether paths from this store can be used as substitutes
170 even if they are not signed by a key listed in the
171 [`trusted-public-keys`](@docroot@/command-ref/conf-file.md#conf-trusted-public-keys)
172 setting.
173 )"};
174
175 Setting<int> priority{this, 0, "priority",
176 R"(
177 Priority of this store when used as a substituter. A lower value means a higher priority.
178 )"};
179
180 Setting<bool> wantMassQuery{this, false, "want-mass-query",
181 R"(
182 Whether this store (when used as a substituter) can be
183 queried efficiently for path validity.
184 )"};
185
186 Setting<StringSet> systemFeatures{this, getDefaultSystemFeatures(),
187 "system-features",
188 "Optional features that the system this store builds on implements (like \"kvm\").",
189 {},
190 // Don't document the machine-specific default value
191 false};
192};
193
194class Store : public std::enable_shared_from_this<Store>
195{
196protected:
197
199
203 std::chrono::time_point<std::chrono::steady_clock> time_point = std::chrono::steady_clock::now();
204
208 std::shared_ptr<const ValidPathInfo> value;
209
214 bool isKnownNow();
215
220 inline bool didExist() {
221 return value != nullptr;
222 }
223 };
224
225 struct State
226 {
228 };
229
231
232 std::shared_ptr<NarInfoDiskCache> diskCache;
233
234 Store(const StoreConfig & config);
235
236public:
241 virtual kj::Promise<Result<void>> init()
242 {
243 return {result::success()};
244 }
245
246 virtual StoreConfig & config() = 0;
247 virtual const StoreConfig & config() const = 0;
248
249 virtual ~Store() noexcept(false) { }
250
251 virtual std::string getUri() = 0;
252
253 StorePath parseStorePath(std::string_view path) const;
254
255 std::optional<StorePath> maybeParseStorePath(std::string_view path) const;
256
257 std::string printStorePath(const StorePath & path) const;
258
264 StorePathSet parseStorePathSet(const PathSet & paths) const;
265
266 PathSet printStorePathSet(const StorePathSet & path) const;
267
272 std::string showPaths(const StorePathSet & paths);
273
278 bool isInStore(PathView path) const;
279
284 bool isStorePath(std::string_view path) const;
285
290 std::pair<StorePath, Path> toStorePath(PathView path) const;
291
295 Path followLinksToStore(std::string_view path) const;
296
301 StorePath followLinksToStorePath(std::string_view path) const;
302
306 StorePath makeStorePath(std::string_view type,
307 std::string_view hash, std::string_view name) const;
308 StorePath makeStorePath(std::string_view type,
309 const Hash & hash, std::string_view name) const;
310
311 StorePath makeOutputPath(std::string_view id,
312 const Hash & hash, std::string_view name) const;
313
314 StorePath makeFixedOutputPath(std::string_view name, const FixedOutputInfo & info) const;
315
316 StorePath makeTextPath(std::string_view name, const TextInfo & info) const;
317
318 StorePath makeFixedOutputPathFromCA(std::string_view name, const ContentAddressWithReferences & ca) const;
319
325 StorePath
326 computeStorePathForPathRecursive(std::string_view name, const PreparedDump & source) const;
327 StorePath computeStorePathForPathFlat(std::string_view name, const Path & srcPath) const;
328
345 StorePath computeStorePathForText(
346 std::string_view name,
347 std::string_view s,
348 const StorePathSet & references) const;
349
354 kj::Promise<Result<bool>> isValidPath(const StorePath & path);
355
356protected:
357
358 virtual kj::Promise<Result<bool>> isValidPathUncached(const StorePath & path);
359
360public:
361
367 kj::Promise<Result<void>> substitutePaths(const StorePathSet & paths);
368
373 virtual kj::Promise<Result<StorePathSet>> queryValidPaths(const StorePathSet & paths,
374 SubstituteFlag maybeSubstitute = NoSubstitute);
375
384 virtual kj::Promise<Result<StorePathSet>> queryAllValidPaths()
385 try { unsupported("queryAllValidPaths"); } catch (...) { return {result::current_exception()}; }
386
387 constexpr static const char * MissingName = "x";
388
393 kj::Promise<Result<ref<const ValidPathInfo>>> queryPathInfo(const StorePath & path);
394
398 kj::Promise<Result<std::shared_ptr<const Realisation>>> queryRealisation(const DrvOutput &);
399
400
412 virtual bool pathInfoIsUntrusted(const ValidPathInfo &)
413 {
414 return true;
415 }
416
417 virtual bool realisationIsUntrusted(const Realisation & )
418 {
419 return true;
420 }
421
422protected:
423
428 virtual kj::Promise<Result<std::shared_ptr<const ValidPathInfo>>>
430 virtual kj::Promise<Result<std::shared_ptr<const Realisation>>>
431 queryRealisationUncached(const DrvOutput &) = 0;
432
433public:
434
439 virtual kj::Promise<Result<void>>
440 queryReferrers(const StorePath & path, StorePathSet & referrers)
441 try { unsupported("queryReferrers"); } catch (...) { return {result::current_exception()}; }
442
451 virtual kj::Promise<Result<StorePathSet>> queryValidDerivers(const StorePath & path)
452 {
453 return {StorePathSet{}};
454 }
455
459 virtual kj::Promise<Result<StorePathSet>> queryDerivationOutputs(const StorePath & path);
460
466 virtual kj::Promise<Result<std::map<std::string, std::optional<StorePath>>>>
467 queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr);
468
477 virtual kj::Promise<Result<std::map<std::string, std::optional<StorePath>>>>
479
484 kj::Promise<Result<OutputPathMap>>
485 queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr);
486
491 virtual kj::Promise<Result<std::optional<StorePath>>>
492 queryPathFromHashPart(const std::string & hashPart) = 0;
493
497 virtual kj::Promise<Result<StorePathSet>> querySubstitutablePaths(const StorePathSet & paths)
498 {
499 return {StorePathSet{}};
500 }
501
509 virtual kj::Promise<Result<void>> querySubstitutablePathInfos(const StorePathCAMap & paths,
510 SubstitutablePathInfos & infos);
511
515 virtual kj::Promise<Result<void>> addToStore(
516 const ValidPathInfo & info,
517 AsyncInputStream & narSource,
518 RepairFlag repair = NoRepair,
519 CheckSigsFlag checkSigs = CheckSigs
520 ) = 0;
521
526 using PathsSource = std::vector<
527 std::pair<ValidPathInfo, std::function<kj::Promise<Result<box_ptr<AsyncInputStream>>>()>>>;
528
532 virtual kj::Promise<Result<void>> addMultipleToStore(
533 PathsSource & pathsToCopy,
534 Activity & act,
535 RepairFlag repair = NoRepair,
536 CheckSigsFlag checkSigs = CheckSigs);
537
546 virtual kj::Promise<Result<StorePath>> addToStoreRecursive(
547 std::string_view name,
548 const PreparedDump & source,
549 HashType hashAlgo = HashType::SHA256,
550 RepairFlag repair = NoRepair);
551 virtual kj::Promise<Result<StorePath>> addToStoreFlat(
552 std::string_view name,
553 const Path & srcPath,
554 HashType hashAlgo = HashType::SHA256,
555 RepairFlag repair = NoRepair);
556
562 kj::Promise<Result<ValidPathInfo>> addToStoreSlow(std::string_view name, const Path & srcPath,
563 FileIngestionMethod method = FileIngestionMethod::Recursive, HashType hashAlgo = HashType::SHA256,
564 std::optional<Hash> expectedCAHash = {});
565
575 virtual kj::Promise<Result<StorePath>> addToStoreFromDump(
576 AsyncInputStream & dump,
577 std::string_view name,
578 FileIngestionMethod method = FileIngestionMethod::Recursive,
579 HashType hashAlgo = HashType::SHA256,
580 RepairFlag repair = NoRepair,
581 const StorePathSet & references = StorePathSet()
582 )
583 try { unsupported("addToStoreFromDump"); } catch (...) { return {result::current_exception()}; }
584
589 virtual kj::Promise<Result<StorePath>> addTextToStore(
590 std::string_view name,
591 std::string_view s,
592 const StorePathSet & references,
593 RepairFlag repair = NoRepair) = 0;
594
604 virtual kj::Promise<Result<void>> registerDrvOutput(const Realisation & output)
605 try { unsupported("registerDrvOutput"); } catch (...) { return {result::current_exception()}; }
606 virtual kj::Promise<Result<void>>
607 registerDrvOutput(const Realisation & output, CheckSigsFlag checkSigs)
608 {
609 return registerDrvOutput(output);
610 }
611
615 virtual kj::Promise<Result<box_ptr<Source>>> narFromPath(const StorePath & path) = 0;
616
627 virtual kj::Promise<Result<void>> buildPaths(
628 const std::vector<DerivedPath> & paths,
629 BuildMode buildMode = bmNormal,
630 std::shared_ptr<Store> evalStore = nullptr);
631
638 virtual kj::Promise<Result<std::vector<KeyedBuildResult>>> buildPathsWithResults(
639 const std::vector<DerivedPath> & paths,
640 BuildMode buildMode = bmNormal,
641 std::shared_ptr<Store> evalStore = nullptr);
642
678 virtual kj::Promise<Result<BuildResult>> buildDerivation(
679 const StorePath & drvPath,
680 const BasicDerivation & drv,
681 BuildMode buildMode = bmNormal
682 );
683
689 virtual kj::Promise<Result<void>> ensurePath(const StorePath & path);
690
695 virtual kj::Promise<Result<void>> addTempRoot(const StorePath & path)
696 try {
697 debug("not creating temporary root, store doesn't support GC");
698 return {result::success()};
699 } catch (...) {
700 return {result::current_exception()};
701 }
702
708 kj::Promise<Result<std::string>> makeValidityRegistration(const StorePathSet & paths,
709 bool showDerivers, bool showHash);
710
721 kj::Promise<Result<JSON>> pathInfoToJSON(const StorePathSet & storePaths,
722 bool includeImpureInfo, bool showClosureSize,
723 Base hashBase = Base::Base32,
724 AllowInvalidFlag allowInvalid = DisallowInvalid);
725
731 kj::Promise<Result<std::pair<uint64_t, uint64_t>>> getClosureSize(const StorePath & storePath);
732
737 virtual kj::Promise<Result<void>> optimiseStore() { return {result::success()}; }
738
744 virtual kj::Promise<Result<bool>> verifyStore(bool checkContents, RepairFlag repair = NoRepair)
745 {
746 return {false};
747 }
748
753
758 virtual kj::Promise<Result<void>> repairPath(const StorePath & path);
759
764 virtual kj::Promise<Result<void>>
765 addSignatures(const StorePath & storePath, const StringSet & sigs)
766 try { unsupported("addSignatures"); } catch (...) { return {result::current_exception()}; }
767
768 /* Utility functions. */
769
774 kj::Promise<Result<Derivation>> derivationFromPath(const StorePath & drvPath);
775
779 kj::Promise<Result<Derivation>> readDerivation(const StorePath & drvPath);
780
784 kj::Promise<Result<Derivation>> readInvalidDerivation(const StorePath & drvPath);
785
796 virtual kj::Promise<Result<void>> computeFSClosure(const StorePathSet & paths,
797 StorePathSet & out, bool flipDirection = false,
798 bool includeOutputs = false, bool includeDerivers = false);
799
800 kj::Promise<Result<void>> computeFSClosure(const StorePath & path,
801 StorePathSet & out, bool flipDirection = false,
802 bool includeOutputs = false, bool includeDerivers = false);
803
809 virtual kj::Promise<Result<void>> queryMissing(const std::vector<DerivedPath> & targets,
810 StorePathSet & willBuild, StorePathSet & willSubstitute, StorePathSet & unknown,
811 uint64_t & downloadSize, uint64_t & narSize);
812
817 kj::Promise<Result<StorePaths>> topoSortPaths(const StorePathSet & paths);
818
823 kj::Promise<Result<void>> exportPaths(const StorePathSet & paths, Sink & sink);
824
825 kj::Promise<Result<void>> exportPath(const StorePath & path, Sink & sink);
826
832 kj::Promise<Result<StorePaths>>
833 importPaths(Source & source, CheckSigsFlag checkSigs = CheckSigs);
834
835 template<template<typename> typename Wrapper = std::type_identity_t>
836 struct Stats
837 {
838 Wrapper<uint64_t> narInfoRead{0};
839 Wrapper<uint64_t> narInfoReadAverted{0};
840 Wrapper<uint64_t> narInfoMissing{0};
841 Wrapper<uint64_t> narInfoWrite{0};
842 Wrapper<uint64_t> pathInfoCacheSize{0};
843 Wrapper<uint64_t> narRead{0};
844 Wrapper<uint64_t> narReadBytes{0};
845 Wrapper<uint64_t> narReadCompressedBytes{0};
846 Wrapper<uint64_t> narWrite{0};
847 Wrapper<uint64_t> narWriteAverted{0};
848 Wrapper<uint64_t> narWriteBytes{0};
849 Wrapper<uint64_t> narWriteCompressedBytes{0};
850 Wrapper<uint64_t> narWriteCompressionTimeMs{0};
851 };
852
853 kj::Promise<Result<Stats<>>> getStats();
854
859 kj::Promise<Result<StorePathSet>>
860 exportReferences(const StorePathSet & storePaths, const StorePathSet & inputPaths);
861
867 kj::Promise<Result<std::optional<StorePath>>> getBuildDerivationPath(const StorePath &);
868
873 kj::Promise<void> clearPathInfoCache()
874 {
875 (co_await state.lock())->pathInfoCache.clear();
876 }
877
882 virtual kj::Promise<Result<void>> connect() { return {result::success()}; }
883
887 virtual kj::Promise<Result<unsigned int>> getProtocol()
888 {
889 return {result::success(0)};
890 };
891
900 virtual kj::Promise<Result<std::optional<TrustedFlag>>> isTrustedClient() = 0;
901
902
903 virtual Path toRealPath(const Path & storePath)
904 {
905 return storePath;
906 }
907
908 Path toRealPath(const StorePath & storePath)
909 {
910 return toRealPath(printStorePath(storePath));
911 }
912
917 virtual kj::Promise<Result<void>> setOptions() { return {result::success()}; }
918
919 virtual kj::Promise<Result<std::optional<std::string>>> getVersion()
920 {
921 return {result::success(std::nullopt)};
922 }
923
924protected:
925
926 Stats<std::atomic> stats;
927
935 [[noreturn]] void unsupported(const std::string & op)
936 {
937 throw Unsupported("operation '%s' is not supported by store '%s'", op, getUri());
938 }
939
940};
941
942
946kj::Promise<Result<void>> copyStorePath(
947 Store & srcStore,
948 Store & dstStore,
949 const StorePath & storePath,
950 RepairFlag repair = NoRepair,
951 CheckSigsFlag checkSigs = CheckSigs);
952
953
962kj::Promise<Result<std::map<StorePath, StorePath>>> copyPaths(
963 Store & srcStore, Store & dstStore,
964 const RealisedPath::Set &,
965 RepairFlag repair = NoRepair,
966 CheckSigsFlag checkSigs = CheckSigs,
967 SubstituteFlag substitute = NoSubstitute);
968
969kj::Promise<Result<std::map<StorePath, StorePath>>> copyPaths(
970 Store & srcStore, Store & dstStore,
971 const StorePathSet & paths,
972 RepairFlag repair = NoRepair,
973 CheckSigsFlag checkSigs = CheckSigs,
974 SubstituteFlag substitute = NoSubstitute);
975
979kj::Promise<Result<void>> copyClosure(
980 Store & srcStore, Store & dstStore,
981 const RealisedPath::Set & paths,
982 RepairFlag repair = NoRepair,
983 CheckSigsFlag checkSigs = CheckSigs,
984 SubstituteFlag substitute = NoSubstitute);
985
986kj::Promise<Result<void>> copyClosure(
987 Store & srcStore, Store & dstStore,
988 const StorePathSet & paths,
989 RepairFlag repair = NoRepair,
990 CheckSigsFlag checkSigs = CheckSigs,
991 SubstituteFlag substitute = NoSubstitute);
992
999
1000
1005kj::Promise<Result<StorePath>>
1006resolveDerivedPath(Store &, const SingleDerivedPath &, Store * evalStore = nullptr);
1007kj::Promise<Result<OutputPathMap>>
1008resolveDerivedPath(Store &, const DerivedPath::Built &, Store * evalStore = nullptr);
1009
1042kj::Promise<Result<ref<Store>>> openStore(const std::string & uri = settings.storeUri.get(),
1043 const StoreConfig::Params & extraParams = {});
1044
1045
1050kj::Promise<Result<std::list<ref<Store>>>> getDefaultSubstituters();
1051
1053{
1054 std::set<std::string> uriSchemes;
1055 std::function<
1056 std::shared_ptr<Store> (
1057 const std::string & scheme,
1058 const std::string & uri,
1059 const StoreConfig::Params & params
1060 )
1061 > create;
1062 std::function<std::shared_ptr<StoreConfig> ()> getConfig;
1063};
1064
1066{
1067 static std::vector<StoreFactory> * registered;
1068
1069 template<typename T, typename TConfig>
1070 static void add()
1071 {
1072 if (!registered) registered = new std::vector<StoreFactory>();
1073 StoreFactory factory{
1074 .uriSchemes = T::uriSchemes(),
1075 .create =
1076 ([](const std::string & scheme, const std::string & uri, const StoreConfig::Params & params)
1077 -> std::shared_ptr<Store>
1078 { return std::make_shared<T>(scheme, uri, params); }),
1079 .getConfig =
1080 ([]()
1081 -> std::shared_ptr<StoreConfig>
1082 { return std::make_shared<TConfig>(StringMap({})); })
1083 };
1084 registered->push_back(factory);
1085 }
1086};
1087
1088
1093std::string showPaths(const PathSet & paths);
1094
1095
1096std::optional<ValidPathInfo> decodeValidPathInfo(
1097 const Store & store,
1098 std::istream & str,
1099 std::optional<HashResult> hashGiven = std::nullopt);
1100
1104std::pair<std::string, StoreConfig::Params> splitUriAndParams(const std::string & uri);
1105
1106const ContentAddress * getDerivationCA(const BasicDerivation & drv);
1107
1108kj::Promise<Result<std::map<DrvOutput, StorePath>>> drvOutputReferences(
1109 Store & store,
1110 const Derivation & drv,
1111 const StorePath & outputPath,
1112 Store * evalStore = nullptr);
1113
1114}
Definition async-io.hh:19
Definition config.hh:131
Definition fs-accessor.hh:15
Definition lru-cache.hh:16
Definition nar-info-disk-cache.hh:11
Definition config.hh:333
Definition path.hh:21
Definition store-api.hh:195
virtual kj::Promise< Result< StorePathSet > > queryValidDerivers(const StorePath &path)
Definition store-api.hh:451
virtual kj::Promise< Result< StorePathSet > > querySubstitutablePaths(const StorePathSet &paths)
Definition store-api.hh:497
virtual kj::Promise< Result< std::map< std::string, std::optional< StorePath > > > > queryPartialDerivationOutputMap(const StorePath &path, Store *evalStore=nullptr)
Definition store-api.cc:532
kj::Promise< Result< ref< const ValidPathInfo > > > queryPathInfo(const StorePath &path)
Definition store-api.cc:708
virtual kj::Promise< Result< void > > buildPaths(const std::vector< DerivedPath > &paths, BuildMode buildMode=bmNormal, std::shared_ptr< Store > evalStore=nullptr)
Definition entry-points.cc:11
kj::Promise< Result< StorePathSet > > exportReferences(const StorePathSet &storePaths, const StorePathSet &inputPaths)
Definition store-api.cc:918
StorePath makeStorePath(std::string_view type, std::string_view hash, std::string_view name) const
Definition store-api.cc:161
virtual kj::Promise< Result< void > > queryMissing(const std::vector< DerivedPath > &targets, StorePathSet &willBuild, StorePathSet &willSubstitute, StorePathSet &unknown, uint64_t &downloadSize, uint64_t &narSize)
Definition misc.cc:358
virtual kj::Promise< Result< bool > > verifyStore(bool checkContents, RepairFlag repair=NoRepair)
Definition store-api.hh:744
kj::Promise< Result< std::optional< StorePath > > > getBuildDerivationPath(const StorePath &)
Definition store-api.cc:1440
virtual kj::Promise< Result< StorePath > > addToStoreRecursive(std::string_view name, const PreparedDump &source, HashType hashAlgo=HashType::SHA256, RepairFlag repair=NoRepair)
Definition store-api.cc:283
kj::Promise< Result< Derivation > > readDerivation(const StorePath &drvPath)
Definition store-api.cc:1469
virtual kj::Promise< Result< void > > ensurePath(const StorePath &path)
Definition entry-points.cc:110
kj::Promise< Result< std::shared_ptr< const Realisation > > > queryRealisation(const DrvOutput &)
Definition store-api.cc:762
virtual kj::Promise< Result< void > > optimiseStore()
Definition store-api.hh:737
virtual kj::Promise< Result< void > > repairPath(const StorePath &path)
Definition entry-points.cc:136
StorePathSet parseStorePathSet(const PathSet &paths) const
Definition path.cc:95
StorePath followLinksToStorePath(std::string_view path) const
Definition store-api.cc:73
virtual kj::Promise< Result< void > > registerDrvOutput(const Realisation &output)
Definition store-api.hh:604
virtual kj::Promise< Result< void > > querySubstitutablePathInfos(const StorePathCAMap &paths, SubstitutablePathInfos &infos)
Definition store-api.cc:588
kj::Promise< Result< Derivation > > readInvalidDerivation(const StorePath &drvPath)
Definition store-api.cc:1472
kj::Promise< Result< Derivation > > derivationFromPath(const StorePath &drvPath)
Definition store-api.cc:1415
virtual kj::Promise< Result< StorePath > > addToStoreFromDump(AsyncInputStream &dump, std::string_view name, FileIngestionMethod method=FileIngestionMethod::Recursive, HashType hashAlgo=HashType::SHA256, RepairFlag repair=NoRepair, const StorePathSet &references=StorePathSet())
Definition store-api.hh:575
kj::Promise< Result< ValidPathInfo > > addToStoreSlow(std::string_view name, const Path &srcPath, FileIngestionMethod method=FileIngestionMethod::Recursive, HashType hashAlgo=HashType::SHA256, std::optional< Hash > expectedCAHash={})
Definition store-api.cc:408
kj::Promise< void > clearPathInfoCache()
Definition store-api.hh:873
kj::Promise< Result< JSON > > pathInfoToJSON(const StorePathSet &storePaths, bool includeImpureInfo, bool showClosureSize, Base hashBase=Base::Base32, AllowInvalidFlag allowInvalid=DisallowInvalid)
Definition store-api.cc:955
kj::Promise< Result< bool > > isValidPath(const StorePath &path)
Definition store-api.cc:645
virtual kj::Promise< Result< std::optional< StorePath > > > queryPathFromHashPart(const std::string &hashPart)=0
virtual kj::Promise< Result< unsigned int > > getProtocol()
Definition store-api.hh:887
virtual kj::Promise< Result< BuildResult > > buildDerivation(const StorePath &drvPath, const BasicDerivation &drv, BuildMode buildMode=bmNormal)
Definition entry-points.cc:74
virtual kj::Promise< Result< StorePathSet > > queryDerivationOutputs(const StorePath &path)
Definition store-api.cc:575
virtual kj::Promise< Result< StorePathSet > > queryValidPaths(const StorePathSet &paths, SubstituteFlag maybeSubstitute=NoSubstitute)
Definition store-api.cc:823
kj::Promise< Result< StorePaths > > topoSortPaths(const StorePathSet &paths)
Definition misc.cc:376
Path followLinksToStore(std::string_view path) const
Definition store-api.cc:59
virtual kj::Promise< Result< std::optional< TrustedFlag > > > isTrustedClient()=0
virtual kj::Promise< Result< void > > setOptions()
Definition store-api.hh:917
kj::Promise< Result< OutputPathMap > > queryDerivationOutputMap(const StorePath &path, Store *evalStore=nullptr)
Definition store-api.cc:561
virtual kj::Promise< Result< std::shared_ptr< const ValidPathInfo > > > queryPathInfoUncached(const StorePath &path)=0
virtual ref< FSAccessor > getFSAccessor()=0
virtual kj::Promise< Result< void > > addTempRoot(const StorePath &path)
Definition store-api.hh:695
virtual kj::Promise< Result< void > > connect()
Definition store-api.hh:882
kj::Promise< Result< void > > substitutePaths(const StorePathSet &paths)
Definition store-api.cc:796
kj::Promise< Result< std::pair< uint64_t, uint64_t > > > getClosureSize(const StorePath &storePath)
Definition store-api.cc:1032
kj::Promise< Result< StorePaths > > importPaths(Source &source, CheckSigsFlag checkSigs=CheckSigs)
Definition export-import.cc:59
bool isInStore(PathView path) const
Definition store-api.cc:41
StorePath computeStorePathForText(std::string_view name, std::string_view s, const StorePathSet &references) const
Definition store-api.cc:271
virtual kj::Promise< Result< StorePath > > addTextToStore(std::string_view name, std::string_view s, const StorePathSet &references, RepairFlag repair=NoRepair)=0
virtual kj::Promise< Result< void > > addToStore(const ValidPathInfo &info, AsyncInputStream &narSource, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs)=0
std::string showPaths(const StorePathSet &paths)
Definition store-api.cc:1398
virtual kj::Promise< Result< void > > addMultipleToStore(PathsSource &pathsToCopy, Activity &act, RepairFlag repair=NoRepair, CheckSigsFlag checkSigs=CheckSigs)
Definition store-api.cc:312
virtual kj::Promise< Result< std::vector< KeyedBuildResult > > > buildPathsWithResults(const std::vector< DerivedPath > &paths, BuildMode buildMode=bmNormal, std::shared_ptr< Store > evalStore=nullptr)
Definition entry-points.cc:50
virtual kj::Promise< Result< void > > addSignatures(const StorePath &storePath, const StringSet &sigs)
Definition store-api.hh:765
kj::Promise< Result< std::string > > makeValidityRegistration(const StorePathSet &paths, bool showDerivers, bool showHash)
Definition store-api.cc:887
virtual kj::Promise< Result< std::map< std::string, std::optional< StorePath > > > > queryStaticPartialDerivationOutputMap(const StorePath &path)
Definition store-api.cc:519
virtual kj::Promise< Result< void > > init()
Definition store-api.hh:241
void unsupported(const std::string &op)
Definition store-api.hh:935
bool isStorePath(std::string_view path) const
Definition path.cc:90
kj::Promise< Result< void > > exportPaths(const StorePathSet &paths, Sink &sink)
Definition export-import.cc:12
virtual kj::Promise< Result< void > > computeFSClosure(const StorePathSet &paths, StorePathSet &out, bool flipDirection=false, bool includeOutputs=false, bool includeDerivers=false)
Definition misc.cc:17
std::vector< std::pair< ValidPathInfo, std::function< kj::Promise< Result< box_ptr< AsyncInputStream > > >()> > > PathsSource
Definition store-api.hh:526
virtual bool pathInfoIsUntrusted(const ValidPathInfo &)
Definition store-api.hh:412
virtual kj::Promise< Result< StorePathSet > > queryAllValidPaths()
Definition store-api.hh:384
StorePath computeStorePathForPathRecursive(std::string_view name, const PreparedDump &source) const
Definition store-api.cc:249
std::pair< StorePath, Path > toStorePath(PathView path) const
Definition store-api.cc:47
virtual kj::Promise< Result< box_ptr< Source > > > narFromPath(const StorePath &path)=0
virtual kj::Promise< Result< void > > queryReferrers(const StorePath &path, StorePathSet &referrers)
Definition store-api.hh:440
Definition sync.hh:37
Lock lock()
Definition sync.hh:154
Definition ref.hh:17
FileIngestionMethod
Definition content-address.hh:38
SourcePath.
const uint32_t exportMagic
Definition store-api.hh:103
void removeTempRoots()
Definition logging.hh:185
Definition derivations.hh:274
Definition build-result.hh:17
Definition content-address.hh:126
Definition derivations.hh:324
Definition derived-path.hh:170
Definition realisation.hh:24
Definition build-result.hh:135
Definition archive.hh:76
Definition realisation.hh:49
Definition derived-path.hh:101
Definition store-api.hh:122
virtual const std::string name()=0
virtual std::string doc()
Definition store-api.hh:141
virtual std::optional< ExperimentalFeature > experimentalFeature() const
Definition store-api.hh:150
Definition store-api.hh:1053
Definition store-api.hh:1066
Definition store-api.hh:198
std::shared_ptr< const ValidPathInfo > value
Definition store-api.hh:208
bool didExist()
Definition store-api.hh:220
bool isKnownNow()
Definition store-api.cc:509
std::chrono::time_point< std::chrono::steady_clock > time_point
Definition store-api.hh:203
Definition store-api.hh:226
Definition store-api.hh:837
Definition path-info.hh:83
Definition json-fwd.hh:21
std::string Path
Definition types.hh:28