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 completion_fences(&self) -> CompletionFences
pub fn completion_fences(&self) -> CompletionFences
Share the generation registry with non-blocking outbox dispatch.
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.
Sourcepub fn new(heartbeat_window: Duration) -> Self
pub fn new(heartbeat_window: Duration) -> Self
Build a sink whose transport-loss ledger derives its budget from the
operator’s heartbeat window (see
transport_loss).
The window is a CONSTRUCTOR parameter rather than a builder step, and
that is the point: there is no way to obtain a PendingActivities
without naming the window, so a wiring cannot supply everything else and
silently inherit a zero budget. The previous shape —
default().with_heartbeat_window(w) — was two calls where the second was
omissible, and nothing in the test suite could tell the wired world from
the unwired one.
Sourcepub fn lease_recorder(&self) -> LeaseRecorderSeam
pub fn lease_recorder(&self) -> LeaseRecorderSeam
The shared lease-record seam, for an outbox dispatcher built over the same pending set to record through.
Sourcepub fn set_lease_recorder(
&self,
recorder: Arc<dyn ActivityLeaseRecorder>,
metrics: Option<Metrics>,
)
pub fn set_lease_recorder( &self, recorder: Arc<dyn ActivityLeaseRecorder>, metrics: Option<Metrics>, )
Install the lease recorder once the engine exists; a duplicate install keeps the first and is logged by the seam.
Sourcepub const fn transport_losses(&self) -> &TransportLossLedger
pub const fn transport_losses(&self) -> &TransportLossLedger
The transport-loss ledger this sink classifies worker deaths through.
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 moreAuto 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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
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