OperationContext

Per-operation identity, deadline, and cancellation state.

Usage

Source

OperationContext()

The host supplies one context per operation. Adapters correlate request and result envelopes by operation_id and treat deadline_monotonic as the expiry point on the host’s monotonic clock (HostServices.monotonic).

Attributes

operation_id: str

Identity of the running operation; request and result envelopes carry the same value.

dataset_id: str | None

Optional dataset correlation id, or None when the operation is not part of a dataset.

deadline_monotonic: float
Deadline on the host’s monotonic clock in seconds. Once HostServices.monotonic() reaches it, the operation must fail rather than transmit.

See Also

Adapter

lifecycle that consumes a context per operation.

HostServices

scoped services that own the monotonic clock.

Methods

Name Description
is_cancelled() Report whether the host has cancelled the operation.
mark_dispatch_started() Mark dispatch immediately before the adapter’s first transmit.

is_cancelled()

Report whether the host has cancelled the operation.

Usage

Source

is_cancelled()

mark_dispatch_started()

Mark dispatch immediately before the adapter’s first transmit.

Usage

Source

mark_dispatch_started()

The host uses this marker to tell failures that never reached the device (dispatch_state: "not_dispatched") from uncertain outcomes after a transmit (dispatch_state: "unknown").