pub struct WorkerActivityDispatcher { /* private fields */ }Expand description
Dispatcher that routes run_activity NIF calls to connected workers.
Synchronous interface — uses try_send for the task channel and
std::sync::mpsc::Receiver::recv for the response. Callers on a
multi-thread tokio runtime are detected and moved into
tokio::task::block_in_place so the blocking wait never starves the
runtime tasks that flush the worker stream (see the module docs).
Implementations§
Source§impl WorkerActivityDispatcher
impl WorkerActivityDispatcher
Sourcepub fn new(
registry: ConnectedWorkerRegistry,
namespace: impl Into<String>,
heartbeat_tracker: HeartbeatTracker,
) -> Self
pub fn new( registry: ConnectedWorkerRegistry, namespace: impl Into<String>, heartbeat_tracker: HeartbeatTracker, ) -> Self
Build a dispatcher for the given namespace, worker registry, and liveness tracker.
The tracker must be the same instance the worker stream handler and shutdown coordinator share: the unbounded completion wait relies on stream teardown sweeping this tracker’s in-flight entries to fail dispatches whose worker was lost.
Sourcepub fn with_pending(self, pending: PendingActivities) -> Self
pub fn with_pending(self, pending: PendingActivities) -> Self
Share a caller-supplied pending-activities tracker.
Sourcepub fn with_drain_state(self, drain_state: DrainState) -> Self
pub fn with_drain_state(self, drain_state: DrainState) -> Self
Share the server drain gate.
Sourcepub fn with_tokio_handle(self, tokio_handle: Handle) -> Self
pub fn with_tokio_handle(self, tokio_handle: Handle) -> Self
Share the server runtime handle for sync history writes from dirty NIF threads.
Trait Implementations§
Source§impl ActivityDispatcher for WorkerActivityDispatcher
impl ActivityDispatcher for WorkerActivityDispatcher
Auto Trait Implementations§
impl !RefUnwindSafe for WorkerActivityDispatcher
impl !UnwindSafe for WorkerActivityDispatcher
impl Freeze for WorkerActivityDispatcher
impl Send for WorkerActivityDispatcher
impl Sync for WorkerActivityDispatcher
impl Unpin for WorkerActivityDispatcher
impl UnsafeUnpin for WorkerActivityDispatcher
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> 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::RequestSource§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