载入中...
搜索中...
未找到
EvpackRegistry.cpp
浏览该文件的文档.
41Result<PreparedEvpackMount> prepareEvpackMount(std::span<const std::uint8_t> bytes, const EvpackLimits& limits,
52 DiagnosticCode::InvalidArgument, "registry callback is empty", {}, {}, "asset.evpack.registry"));
56 Diagnostic::error(DiagnosticCode::InvariantViolation, "registry subscription identity is exhausted", {}, {},
70 return Result<void>::failure(Diagnostic::error(DiagnosticCode::NotFound, "registry subscription is not active",
137 const EvpackRegistryEvent event{replaced ? EvpackRegistryEventKind::Replaced : EvpackRegistryEventKind::Mounted,
143Result<std::shared_ptr<const Evpack>> EvpackRegistry::resolve(const EvpackHandle& handle) const {
148 Diagnostic::error(DiagnosticCode::NotFound, "runtime package is not mounted", handle.packageId.format(), {},
152 Diagnostic::error(DiagnosticCode::StaleHandle, "runtime package handle is stale", handle.packageId.format(),
157Result<EvpackAssetHandle> EvpackRegistry::resolveAsset(const AssetRef& assetRef, std::string_view expectedType,
161 DiagnosticCode::InvalidArgument, "expected runtime asset type is empty", {}, {}, "asset.evpack.registry"));
183 {{packageId, entry.pack->buildId(), entry.generation}, assetRef, std::string(expectedType), capabilities});
202Result<EvpackChunkHandle> EvpackRegistry::resolveChunk(const EvpackHandle& handle, const PersistentId& assetId,
210 if (chunk.assetId == assetId && chunk.type == type && chunk.kind == kind && chunk.chunkId == chunkId &&
215 DiagnosticCode::NotFound, "runtime chunk is not present", assetId.format(), {}, "asset.evpack.registry"));
218Result<std::vector<std::uint8_t>> EvpackRegistry::copyChunkBytes(const EvpackChunkHandle& handle) const {
224 DiagnosticCode::InvalidArgument, "chunk index is outside the TOC", {}, {}, "asset.evpack.registry"));
238 DiagnosticCode::StaleHandle, "runtime package handle is stale", {}, {}, "asset.evpack.registry"));
257Result<RuntimeAssetPayload> EvpackResourceReader::read(const AssetRef& asset, std::string_view expectedType,
278 if (decodedTotal > maximumDecodedBytes || chunk.decodedSize > maximumDecodedBytes - decodedTotal)
292 Diagnostic::error(DiagnosticCode::TypeMismatch, "asset does not provide the expected type/version",
298 return Result<RuntimeAssetPayload>::failure(Diagnostic::error(DiagnosticCode::NotFound, "asset is not present",
316 Diagnostic::error(DiagnosticCode::InvalidArgument, "pack, expected type and asset budget are required", {},
331 DiagnosticCode::InvalidArgument, "asset listing exceeds result budget", {}, {}, "asset.evpack.reader"));
Prepare/commit runtime package publication with stale-generation detection.
Typed capability-aware runtime access to admitted packs.
const PersistentId & id() const noexcept
Return the stable asset identity.
Definition ResourceRef.h:65
static Result< AssetRef > fromId(PersistentId id)
Build an asset reference from a non-nil persistent identity.
Definition ResourceRef.cpp:26
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Result< RuntimeAssetPayload > readAsset(const EvpackAssetHandle &handle, std::uint64_t maximumDecodedBytes) const
Decode an asset through its generation-qualified provider handle.
Definition EvpackRegistry.cpp:194
Result< std::vector< std::uint8_t > > copyChunkBytes(const EvpackChunkHandle &handle) const
Copy verified chunk bytes so the result remains valid across hot replacement.
Definition EvpackRegistry.cpp:218
Result< std::shared_ptr< const Evpack > > resolve(const EvpackHandle &handle) const
Resolve a current package handle to shared immutable ownership.
Definition EvpackRegistry.cpp:143
Result< EvpackChunkHandle > resolveChunk(const EvpackHandle &handle, const PersistentId &assetId, std::string_view type, EvpackChunkKind kind, std::uint32_t chunkId, std::uint32_t variantIndex) const
Resolve an exact asset/type/kind/variant tuple to a generation-scoped chunk handle.
Definition EvpackRegistry.cpp:202
Result< void > unsubscribe(EvpackRegistrySubscription subscription)
Cancel a live subscription; an unknown token returns NotFound.
Definition EvpackRegistry.cpp:63
Result< EvpackRegistrySubscription > subscribe(Callback callback)
Subscribe to committed lifecycle changes.
Definition EvpackRegistry.cpp:49
Result< EvpackAssetHandle > resolveAsset(const AssetRef &asset, std::string_view expectedType, const EvpackCapabilities &capabilities) const
Resolve one stable AssetRef across uniquely owning mounted packages.
Definition EvpackRegistry.cpp:157
std::function< Result< void >(const EvpackRegistryEvent &)> Callback
Definition EvpackRegistry.h:114
Result< EvpackUnmountReceipt > unmount(const EvpackHandle &handle)
Unmount exactly the referenced current generation and dispatch a lock-free event.
Definition EvpackRegistry.cpp:228
Result< EvpackMountReceipt > commit(PreparedEvpackMount candidate)
Atomically publish an admitted package and invalidate its previous generation.
Definition EvpackRegistry.cpp:75
Immutable reader retaining an admitted pack by shared ownership.
Definition EvpackResourceReader.h:29
Result< std::vector< AssetRef > > listAssets(std::string_view expectedType, const EvpackCapabilities &capabilities, std::uint32_t maximumAssets=1 '000 '000) const
List stable assets providing an exact type/version for the selected runtime variant.
Definition EvpackRegistry.cpp:311
Result< RuntimeAssetPayload > read(const AssetRef &asset, std::string_view expectedType, const EvpackCapabilities &capabilities, std::uint64_t maximumDecodedBytes) const
Resolve, type-check, variant-select and decode a canonical runtime asset.
Definition EvpackRegistry.cpp:257
Owning admitted mount candidate that has not changed observable registry state.
Definition EvpackRegistry.h:77
std::string format() const
Formats the ID in lower-case canonical UUID text.
Definition Identity.h:172
constexpr bool isNil() const noexcept
Returns whether this value is the all-zero nil ID.
Definition Identity.h:175
Definition AssetCooker.cpp:19
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< EvpackVariantSelection > selectEvpackVariant(const Evpack &pack, const EvpackCapabilities &capabilities)
Select the first explicitly ordered variant satisfied by device capabilities.
Definition Evpack.cpp:585
Result< PreparedEvpackMount > prepareEvpackMount(std::span< const std::uint8_t > bytes, const EvpackLimits &limits, const EvpackTrust &trust)
Fully parse and verify package bytes without publishing them.
Definition EvpackRegistry.cpp:41
@ Definition
@ InvalidArgument
@ TypeMismatch
A stable reference resolved to a different canonical domain type.
@ NotFound
@ CallbackFailure
@ Unsupported
@ InvariantViolation
@ Failed
@ StaleHandle
@ Conflict
Generation-scoped stable-reference resolution across mounted packages.
Definition EvpackRegistry.h:36
Actual runtime device capabilities used for variant selection.
Definition Evpack.h:92
Generation-scoped handle to one verified chunk in a mounted package.
Definition EvpackRegistry.h:30
Generation-scoped handle to one mounted runtime package.
Definition EvpackRegistry.h:20
Resource limits checked before package allocations and hash work.
Definition Evpack.h:126
Immutable lifecycle event delivered to registry subscribers.
Definition EvpackRegistry.h:54
Opaque identity used to cancel a registry subscription.
Definition EvpackRegistry.h:60
Owning backend-neutral payload returned to a domain decoder.
Definition EvpackResourceReader.h:20