Skip to content

本页为英文技术参考;字段、编号与支持状态直接来自同一契约源。中文学习路线见 开发文档。

Resources ​

Register cleanup and release owned registrations or subscriptions. This group coordinates specific resource kinds; it is not a universal release API for every opaque value.

Contract: nexa.resources/100. API index.

Typical sequence ​

Retain each acquisition’s actual handle type. ReadSubscription consumes a bounded batch, so retain the same key while resolving an uncertain read. Release a subscription when it is no longer needed.

Behavior and limits ​

A gap requires a new authoritative snapshot or domain-specific resynchronization. Stopped loads cannot reuse prior handles; do not cast blobs or files to RegistrationRef.

The recorded Host maps 4 of 4 operations in this group. A mapping is subject to permission, phase, scope, platform and business preconditions. Host snapshot identifies the source revision; negotiate against the actual installed Host.

Operations ​

RegisterCleanup · Release · ReadSubscription · ReleaseSubscription

RegisterCleanup ​

CleanupRequest → RegistrationRef

PropertyContract
Local SDK method ID2
KindRegistration
Permissionnexa.resources.write
Legal phasesPreInitialize, Initialize, PostInitialize, Checkup, Finalize
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
CallbackulongDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

Retain the registration identity for the permitted update/release operation. Staged registrations become visible only at group activation.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Resources_RegisterCleanup(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Resources_RegisterCleanup_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Release ​

RegistrationRequest → Empty

PropertyContract
Local SDK method ID3
KindMutation
Permissionnexa.resources.write
Legal phasesPreInitialize, Initialize, PostInitialize, Checkup, Finalize, Active, Abort, Stop
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
RegistrationRegistrationRefStructured RegistrationRef value; follow its linked field contract.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Resources_Release(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Resources_Release_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

ReadSubscription ​

SubscriptionRead → SubscriptionBatch

PropertyContract
Local SDK method ID4
KindMutation
Permissionnexa.resources.read
Legal phasesActive
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

The current runtime consumes up to 256 queued items. Repeat an uncertain read with the same idempotency key to retrieve the corresponding batch; a new key is a new consumption request.

Request fields

FieldTypeMeaning
SubscriptionSubscriptionRefStructured SubscriptionRef value; follow its linked field contract.
LimitlongRequested bound on returned items. The Host may impose a smaller domain-specific limit.

Successful result

Decode the exact output model after Success. Preserve its identities, revision and schema metadata for subsequent domain operations.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Resources_ReadSubscription(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Resources_ReadSubscription_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

ReleaseSubscription ​

SubscriptionRef → Empty

PropertyContract
Local SDK method ID5
KindMutation
Permissionnexa.resources.write
Legal phasesActive, Stop
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
TokenGuidOpaque Host-issued handle token. Keep it with its owner and resource type.
LoadInstanceIdGuidIdentity of the admitted load that owns this handle; it is not portable to a replacement load.
Cursorstring?Opaque continuation or observation cursor. Reuse only in the issuing query/scope; absence and invalidity are different. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.
ResyncRequiredboolDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Resources_ReleaseSubscription(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Resources_ReleaseSubscription_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Why numbering starts at 2 ​

Slot 1 is occupied by the retained Bootstrap-era RegisterCleanup in contracts/abi100-legacy.json. It is included in the 22 legacy operations, not a twenty-third burned slot. The current typed cleanup operation has ID 2 and must not be renumbered. The additional reserved slot is Events/3; it remains unavailable.


来源: NexaCL-Plugin-SDK · Apache-2.0.

Site documentation: CC BY-SA 4.0. Imported SDK documents: Apache-2.0 as marked.