Skip to main content

Module runtime

Module runtime 

Source

Structs§

LeaseClient
Shared lease-acquisition client for app-owned pull receivers.

Constants§

LEASE_SAFETY_MARGIN
Safety margin subtracted from a lease’s expiry when computing a command’s execution budget. Stopping this far before the lease actually expires guarantees the runtime finishes (or abandons) the command while the lease is still held, so an expired lease is never redelivered by the manager while a duplicate is still in flight. Used by the app-owned pull Receiver; twin of the TypeScript receiver’s LEASE_SAFETY_MARGIN_MS.

Functions§

command_budget
Per-command execution budget: min(envelope.deadline, lease_expiry − [LEASE_SAFETY_MARGIN]). The LEASE bound is clamped to now; an already-past deadline is not — it yields a zero budget and an immediate HANDLER_TIMEOUT, which is the correct outcome for a command delivered after its deadline. There is no lease-renew call in the protocol, so the safety-margined lease expiry always bounds the budget. Twin of the TypeScript receiver’s commandBudget.
create_test_error
Create a simple error response for testing
create_test_response
Create a simple success response for testing
decode_params
Decode params from an envelope to JSON
decode_params_bytes
Decode params from an envelope to raw bytes
parse_envelope
Parse a QueueMessage to extract a command envelope if present
submit_response
Submit a command response back to the command server