Skip to main content

PendingActivities

Struct PendingActivities 

Source
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

Source

pub fn completion_fences(&self) -> CompletionFences

Share the generation registry with non-blocking outbox dispatch.

Source

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.

Source

pub fn with_heartbeat_window(self, heartbeat_window: Duration) -> Self

Install the operator’s heartbeat window so the transport-loss ledger derives its budget from it (see transport_loss).

Called once at boot on the shared instance; clones made afterwards observe it because the ledger’s state is shared, and the builder replaces the whole ledger before any dispatch runs.

Source

pub const fn transport_losses(&self) -> &TransportLossLedger

The transport-loss ledger this sink classifies worker deaths through.

Trait Implementations§

Source§

impl ActivityCompletionSink for PendingActivities

Source§

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>

Feed one worker-reported result into the engine activity contract. Read more
Source§

impl Clone for PendingActivities

Source§

fn clone(&self) -> PendingActivities

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PendingActivities

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PendingActivities

Source§

fn default() -> PendingActivities

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more