载入中...
搜索中...
未找到
AssetPackageStore.cpp
浏览该文件的文档.
25 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Failed, "cannot create temporary package",
30 const DWORD request = static_cast<DWORD>(std::min<std::size_t>(bytes.size() - cursor, MAXDWORD));
41 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Failed, "cannot flush temporary package",
46 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Failed, "cannot create temporary package",
59 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Failed, "cannot flush temporary package",
65Result<std::vector<std::uint8_t>> readBounded(const std::filesystem::path& path, std::uint64_t maximumBytes) {
69 return Result<std::vector<std::uint8_t>>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument,
75 DiagnosticCode::Failed, "cannot reopen temporary package", path.string(), {}, "asset.package.store"));
77 if (!bytes.empty()) input.read(reinterpret_cast<char*>(bytes.data()), static_cast<std::streamsize>(bytes.size()));
104std::filesystem::path temporaryPath(const std::filesystem::path& destination, std::uint64_t sequence) {
139 Diagnostic::error(DiagnosticCode::InvalidArgument, "package destination is empty", destination.string(), {},
144 if (!destination.parent_path().empty()) std::filesystem::create_directories(destination.parent_path(), ec);
147 Diagnostic::error(DiagnosticCode::Failed, ec.message(), destination.string(), {}, "asset.package.store"));
156 if (beforeReplace_ && beforeReplace_(temporary, destination) == PackagePublishGateDecision::Reject)
172 Diagnostic::error(DiagnosticCode::InvalidArgument, "package destination is empty", destination.string(), {},
177 if (!destination.parent_path().empty()) std::filesystem::create_directories(destination.parent_path(), ec);
180 Diagnostic::error(DiagnosticCode::Failed, ec.message(), destination.string(), {}, "asset.package.store"));
189 if (beforeReplace_ && beforeReplace_(temporary, destination) == PackagePublishGateDecision::Reject)
197 {destination, verified.value().packageId(), verified.value().buildId(), reopened.value().size()});
Reopen-verified atomic publication for .eva and .evpack files.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Result< PackagePublishReceipt > publishEvpack(const std::filesystem::path &destination, std::span< const std::uint8_t > bytes, const EvpackLimits &limits={}, const EvpackTrust &trust={})
Reopen-verify and atomically publish already cooked .evpack bytes.
Definition AssetPackageStore.cpp:167
Result< PackagePublishReceipt > publishEva(const std::filesystem::path &destination, const EvaManifest &manifest, std::vector< EvaArchiveEntry > entries, const EvaArchiveLimits &limits={})
Build, reopen-verify and atomically publish one .eva source archive.
Definition AssetPackageStore.cpp:134
std::function< PackagePublishGateDecision(const std::filesystem::path &temporary, const std::filesystem::path &destination)> BeforeReplace
Definition AssetPackageStore.h:42
AtomicAssetPackageStore(BeforeReplace beforeReplace={})
Construct a publisher, optionally with a failure-injection/policy gate.
Definition AssetPackageStore.cpp:131
Definition AssetCooker.cpp:17
Result< Evpack > parseEvpack(std::span< const std::uint8_t > bytes, const EvpackLimits &limits, const EvpackTrust &trust)
Parse, bound-check and hash-verify a complete untrusted .evpack.
Definition Evpack.cpp:542
Result< std::vector< std::uint8_t > > buildEvaArchive(const EvaManifest &manifest, std::vector< EvaArchiveEntry > entries, const EvaArchiveLimits &limits)
Build a deterministic ZIP64 .eva, selecting raw Deflate only when smaller than Store.
Definition EvaArchive.cpp:408
Result< EvaArchive > parseEvaArchive(std::span< const std::uint8_t > bytes, const EvaArchiveLimits &limits)
Parse and fully verify an untrusted .eva ZIP64 image.
Definition EvaArchive.cpp:505
@ InvalidArgument
@ Cancelled
@ Failed
Definition Container.h:602
Admission budgets applied before allocating decoded archive entries.
Definition EvaArchive.h:21
Resource limits checked before package allocations and hash work.
Definition Evpack.h:126