pub trait WorkflowRuntimeExecution {
// Required methods
fn poll(&mut self) -> Result<WorkflowRuntimePoll>;
fn take_pending_requests(&mut self) -> Result<Vec<WorkflowRuntimeRequest>>;
fn resolve_request(
&mut self,
id: &str,
resolution: WorkflowRuntimeRequestResolution,
) -> Result<()>;
}Expand description
Resumable workflow JavaScript execution.
Runtime executions are expected to be owned by a single scheduler/actor and
accessed serially. Implementations are not required to be Send or safe for
concurrent access. The workflow coordinator should keep JavaScript-engine
calls isolated from provider tasks and communicate through this polling and
request-resolution boundary.
Required Methods§
Sourcefn poll(&mut self) -> Result<WorkflowRuntimePoll>
fn poll(&mut self) -> Result<WorkflowRuntimePoll>
Poll the JavaScript runtime for the next call, request, completion, or pending state.
Sourcefn take_pending_requests(&mut self) -> Result<Vec<WorkflowRuntimeRequest>>
fn take_pending_requests(&mut self) -> Result<Vec<WorkflowRuntimeRequest>>
Drain all currently queued unresolved runtime requests.
Call this after poll returns
WorkflowRuntimePoll::Request when the caller wants to schedule all
JavaScript-created host requests concurrently. Draining removes requests
from the runtime’s event queue, but their JavaScript promises remain
pending and must later be completed with resolve_request.
If callers repeatedly poll after a request is observed without draining or resolving it, implementations may report the same request again.
Sourcefn resolve_request(
&mut self,
id: &str,
resolution: WorkflowRuntimeRequestResolution,
) -> Result<()>
fn resolve_request( &mut self, id: &str, resolution: WorkflowRuntimeRequestResolution, ) -> Result<()>
Resolve or reject a previously emitted runtime request by id.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".