pub struct PendingActivities { /* private fields */ }Expand description
Tracks in-flight activity dispatches waiting for worker results.
When the server’s worker stream handler receives an ActivityResult, it
calls complete_activity to
deliver the result to the blocked NIF thread. Entries are keyed by
[PendingActivityKey] so a stale result from a previous server life can
never be matched to a different execution (#59).
Clones share both the pending map and the outbox-delivery callback through
Arc, so set_outbox_delivery called once on
any clone after construction is visible to the clone the dispatcher holds.
Implementations§
Source§impl PendingActivities
impl PendingActivities
Sourcepub fn set_outbox_delivery(&self, callback: Arc<dyn OutboxDeliveryCallback>)
pub fn set_outbox_delivery(&self, callback: Arc<dyn OutboxDeliveryCallback>)
Install the unmatched-completion delivery callback (idempotent).
Set once, after construction, when the durable outbox is enabled. A second set is ignored and logged: the callback is process-wide and must not silently change identity.
Trait Implementations§
Source§impl ActivityCompletionSink for PendingActivities
impl ActivityCompletionSink for PendingActivities
Source§fn park_activity(
&self,
workflow_id: &WorkflowId,
activity_id: &ActivityId,
) -> Result<(), ServerError>
fn park_activity( &self, workflow_id: &WorkflowId, activity_id: &ActivityId, ) -> Result<(), ServerError>
Park one in-flight dispatch for restart recovery (#207): resolve the matched waiter with the ephemeral parked sentinel, and nothing else.
This resolution is MANDATORY, not an optimization: the default
ActivityDispatcher::dispatch_async runs the dispatcher’s blocking
std::sync::mpsc::recv() on tokio’s blocking pool, and tokio Runtime
drop joins blocking threads — an unresolved waiter would wedge process
exit indefinitely. An unmatched dispatch (already resolved by another
path) is a no-op: a park is NEVER routed to the outbox delivery
callback, because it is not a failure and must never reach a workflow.
Source§fn complete_activity(
&self,
completion: ActivityCompletion,
) -> Result<(), ServerError>
fn complete_activity( &self, completion: ActivityCompletion, ) -> Result<(), ServerError>
Source§impl Clone for PendingActivities
impl Clone for PendingActivities
Source§fn clone(&self) -> PendingActivities
fn clone(&self) -> PendingActivities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PendingActivities
impl Debug for PendingActivities
Source§impl Default for PendingActivities
impl Default for PendingActivities
Source§fn default() -> PendingActivities
fn default() -> PendingActivities
Auto Trait Implementations§
impl !RefUnwindSafe for PendingActivities
impl !UnwindSafe for PendingActivities
impl Freeze for PendingActivities
impl Send for PendingActivities
impl Sync for PendingActivities
impl Unpin for PendingActivities
impl UnsafeUnpin for PendingActivities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request