pub trait EngineHandle: Send + Sync {
// Required methods
fn resolve_workflow(
&self,
workflow_id: &WorkflowId,
) -> Result<WorkflowResidency, EngineSeamError>;
fn deliver_workflow_message(
&self,
process: WorkflowProcessHandle,
message: WorkflowMailboxMessage,
) -> Result<(), EngineSeamError>;
fn spawn_child_workflow(
&self,
request: ChildWorkflowSpawnRequest,
) -> Result<ChildWorkflowSpawnResult, EngineSeamError>;
fn terminate_linked_child_workflow(
&self,
parent_workflow_id: &WorkflowId,
child_process: WorkflowProcessHandle,
correlation: u64,
) -> Result<(), EngineSeamError>;
fn terminate_linked_activity(
&self,
parent_workflow_id: &WorkflowId,
activity_process: Pid,
correlation: u64,
) -> Result<(), EngineSeamError>;
fn arm_timer(&self, entry: TimerWheelEntry) -> Result<(), EngineSeamError>;
fn disarm_timer(
&self,
process: WorkflowProcessHandle,
timer_id: &TimerId,
) -> Result<(), EngineSeamError>;
fn record_workflow_event(
&self,
workflow_id: &WorkflowId,
event: Event,
) -> Result<RecordOutcome, EngineSeamError>;
fn record_redelivered_timer_fire(
&self,
workflow_id: &WorkflowId,
timer_id: &TimerId,
) -> Result<RedeliveredFire, EngineSeamError>;
}Expand description
Engine-facing capabilities consumed by AT services and implemented by AE.
This trait deliberately does not expose operations that start, supervise, tear down, or load
top-level workflow processes. Child spawning, residency resolution, and recording are requests
into AE/AD-owned infrastructure. In particular, EngineHandle::record_workflow_event must
route asynchronous-arrival events through the target workflow’s single Recorder; AT services must
not append directly to the event store.
Required Methods§
Sourcefn resolve_workflow(
&self,
workflow_id: &WorkflowId,
) -> Result<WorkflowResidency, EngineSeamError>
fn resolve_workflow( &self, workflow_id: &WorkflowId, ) -> Result<WorkflowResidency, EngineSeamError>
Resolves a workflow identifier to its current residency state.
§Errors
Returns EngineSeamError when AE cannot inspect residency for the requested workflow.
Sourcefn deliver_workflow_message(
&self,
process: WorkflowProcessHandle,
message: WorkflowMailboxMessage,
) -> Result<(), EngineSeamError>
fn deliver_workflow_message( &self, process: WorkflowProcessHandle, message: WorkflowMailboxMessage, ) -> Result<(), EngineSeamError>
Delivers a message to a resident workflow process mailbox.
§Errors
Returns EngineSeamError when AE cannot enqueue the message on the target mailbox.
Sourcefn spawn_child_workflow(
&self,
request: ChildWorkflowSpawnRequest,
) -> Result<ChildWorkflowSpawnResult, EngineSeamError>
fn spawn_child_workflow( &self, request: ChildWorkflowSpawnRequest, ) -> Result<ChildWorkflowSpawnResult, EngineSeamError>
Requests AE to spawn a child workflow execution linked to the parent process.
§Errors
Returns EngineSeamError when AE rejects or fails the linked child-spawn request.
Sourcefn terminate_linked_child_workflow(
&self,
parent_workflow_id: &WorkflowId,
child_process: WorkflowProcessHandle,
correlation: u64,
) -> Result<(), EngineSeamError>
fn terminate_linked_child_workflow( &self, parent_workflow_id: &WorkflowId, child_process: WorkflowProcessHandle, correlation: u64, ) -> Result<(), EngineSeamError>
Terminates a linked child workflow process through AE’s process-link boundary.
§Errors
Returns EngineSeamError when AE cannot send the cancellation exit to the linked child.
Sourcefn terminate_linked_activity(
&self,
parent_workflow_id: &WorkflowId,
activity_process: Pid,
correlation: u64,
) -> Result<(), EngineSeamError>
fn terminate_linked_activity( &self, parent_workflow_id: &WorkflowId, activity_process: Pid, correlation: u64, ) -> Result<(), EngineSeamError>
Terminates a linked in-VM activity process through AE’s process-link boundary.
§Errors
Returns EngineSeamError when AE cannot send the cancellation exit to the linked child.
Sourcefn arm_timer(&self, entry: TimerWheelEntry) -> Result<(), EngineSeamError>
fn arm_timer(&self, entry: TimerWheelEntry) -> Result<(), EngineSeamError>
Arms a timer-wheel entry for a resident workflow process.
§Errors
Returns EngineSeamError when AE cannot register the timer with the live wheel.
Sourcefn disarm_timer(
&self,
process: WorkflowProcessHandle,
timer_id: &TimerId,
) -> Result<(), EngineSeamError>
fn disarm_timer( &self, process: WorkflowProcessHandle, timer_id: &TimerId, ) -> Result<(), EngineSeamError>
Disarms a timer-wheel entry for a resident workflow process.
§Errors
Returns EngineSeamError when AE cannot remove the timer from the live wheel.
Sourcefn record_workflow_event(
&self,
workflow_id: &WorkflowId,
event: Event,
) -> Result<RecordOutcome, EngineSeamError>
fn record_workflow_event( &self, workflow_id: &WorkflowId, event: Event, ) -> Result<RecordOutcome, EngineSeamError>
Records an event through the target workflow’s single AD Recorder.
Returns RecordOutcome::Recorded when the event was durably appended,
RecordOutcome::AlreadyRecorded when an earlier acknowledgement-lost
append of the same timer fire is found already durable (nothing is
appended and the recorder’s tracked head is reconciled forward —
aion#145), or RecordOutcome::RefusedTerminal when the append was
declined because the active run already recorded a terminal (a benign
late arrival). Callers that follow a recorded fire with a mailbox wake
MUST deliver it for Recorded AND AlreadyRecorded — the durable record
exists in both — and MUST withhold it for RefusedTerminal, which must
not reschedule a terminated workflow.
§Errors
Returns EngineSeamError when the target workflow’s Recorder cannot append the event.
Sourcefn record_redelivered_timer_fire(
&self,
workflow_id: &WorkflowId,
timer_id: &TimerId,
) -> Result<RedeliveredFire, EngineSeamError>
fn record_redelivered_timer_fire( &self, workflow_id: &WorkflowId, timer_id: &TimerId, ) -> Result<RedeliveredFire, EngineSeamError>
Answers, under the recorder lock, whether a REDELIVERY of an
already-recorded fire for timer_id still owes its mailbox wake.
This is the redelivery twin of Self::record_workflow_event and the
only seam a redelivery may use: it NEVER appends. When the timer’s
disposition is still the recorded fire, the recorder’s tracked head is
reconciled forward to the durable head (aion#145) and
RedeliveredFire::WakeOwed instructs the caller to deliver the
wake. Any other disposition — the timer re-armed or cancelled since
the caller’s observation — answers RedeliveredFire::NotOwed
without touching history; routing a redelivery through the generic
append path instead would record a premature TimerFired for the NEW
arming. A terminal active run answers
RedeliveredFire::RefusedTerminal.
§Errors
Returns EngineSeamError when the target workflow’s recorder cannot
be reached.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".