载入中...
搜索中...
未找到
EvpackRange.cpp
浏览该文件的文档.
16 for (unsigned index = 0; index != 8; ++index) value |= std::uint64_t(bytes[offset + index]) << (index * 8);
46 return Result<std::vector<std::uint8_t>>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument,
52 DiagnosticCode::NotFound, "cannot open runtime package", path_.string(), {}, "asset.evpack.range"));
56 DiagnosticCode::Failed, "cannot seek runtime package", path_.string(), {}, "asset.evpack.range"));
58 if (!bytes.empty()) input.read(reinterpret_cast<char*>(bytes.data()), static_cast<std::streamsize>(bytes.size()));
61 DiagnosticCode::Failed, "runtime package range is truncated", path_.string(), {}, "asset.evpack.range"));
82 // Header offsets are still untrusted here; only use them to request the bounded metadata prefix.
90 DiagnosticCode::ParseError, "runtime package metadata extent is invalid", {}, {}, "asset.evpack.range"));
93 if (signatureOffset > sourceSize.value() || signatureSize > sourceSize.value() - signatureOffset)
103 DiagnosticCode::Failed, "range source returned a short metadata prefix", {}, {}, "asset.evpack.range"));
113 DiagnosticCode::InvalidArgument, "chunk index is outside the TOC", {}, {}, "asset.evpack.range"));
116 return Result<std::vector<std::uint8_t>>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument,
123 DiagnosticCode::Failed, "range source returned a short chunk", chunk.type, {}, "asset.evpack.range"));
129 DiagnosticCode::HashMismatch, "range chunk hash does not match", chunk.type, {}, "asset.evpack.range"));
Bounded deterministic compression used by the .evpack wire format.
Range-readable .evpack admission and on-demand verified chunks.
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
Admitted metadata plus an immutable range source retained by shared ownership.
Definition EvpackRange.h:53
const Evpack & index() const noexcept
Verified package metadata and random-access TOC.
Definition EvpackRange.h:56
Result< std::vector< std::uint8_t > > readChunk(std::size_t index) const
Fetch, size-check and hash-verify one complete independently streamable chunk.
Definition EvpackRange.cpp:110
const std::vector< EvpackChunk > & chunks() const noexcept
Verified random-access chunk table.
Definition Evpack.h:173
Result< std::vector< std::uint8_t > > read(std::uint64_t offset, std::uint64_t size) const override
Reads .
Definition EvpackRange.cpp:41
static HashFunction * getHashFunction(std::string function)
Get a HashFunction instance for the given function.
Definition HashFunction.cpp:589
virtual void hash(std::string function, const char *input, uint64_t length, Value &output) const =0
Hash the input, producing an set of bytes as output.
Definition AssetCooker.cpp:17
Result< EvpackRangeMount > prepareEvpackRangeMount(std::shared_ptr< const EvpackRangeSource > source, const EvpackLimits &limits, const EvpackTrust &trust)
Read only header/manifest/TOC and prepare on-demand range loading.
Definition EvpackRange.cpp:65
Result< std::vector< std::uint8_t > > decompressEvpackChunk(EvpackCodec codec, std::span< const std::uint8_t > stored, std::uint64_t decodedSize, std::uint64_t maximumDecodedBytes)
Decode one chunk into its authenticated canonical bytes.
Definition EvpackCompression.cpp:34
Result< Evpack > parseEvpackMetadata(std::span< const std::uint8_t > bytes, std::uint64_t packageSize, const EvpackLimits &limits, const EvpackTrust &trust)
Admit only the contiguous header/manifest/TOC prefix of a range-readable package.
Definition Evpack.cpp:361
@ HashMismatch
@ InvalidArgument
@ NotFound
@ Failed
@ ParseError
Resource limits checked before package allocations and hash work.
Definition Evpack.h:126
std::uint64_t maximumDecodedBytes
Definition Evpack.h:129