pub struct DialMailboxRouter { /* private fields */ }
Expand description
A dynamic mailbox router that supports remote delivery.
DialMailboxRouter
maintains a runtime address book mapping
references to ChannelAddr
s. It holds a cache of active
connections and forwards messages to the appropriate
MailboxClient
.
If a message destination is not bound, but is a “direct mode” address (i.e., its proc id contains the channel address through which the proc is reachable), then DialMailboxRouter dials the proc directly.
Messages sent to unknown destinations are routed to the default
sender, if present.
Implementations§
Source§impl DialMailboxRouter
impl DialMailboxRouter
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new DialMailboxRouter
with an empty routing table.
Sourcepub fn new_with_default(default: BoxedMailboxSender) -> Self
pub fn new_with_default(default: BoxedMailboxSender) -> Self
Create a new DialMailboxRouter
with an empty routing table,
and a default sender. Any message with an unknown destination is
dispatched on this default sender, unless the destination is
direct-addressed, in which case it is dialed directly.
Sourcepub fn new_with_default_direct_addressed_remote_only(
default: BoxedMailboxSender,
) -> Self
pub fn new_with_default_direct_addressed_remote_only( default: BoxedMailboxSender, ) -> Self
Create a new DialMailboxRouter
with an empty routing table,
and a default sender. Any message with an unknown destination is
dispatched on this default sender, unless the destination is
direct-addressed and has a remote channel transport type.
Sourcepub fn bind(&self, dest: Reference, addr: ChannelAddr)
pub fn bind(&self, dest: Reference, addr: ChannelAddr)
Binds a Reference
to a ChannelAddr
, replacing any
existing binding.
If the address changes, the old sender is evicted from the cache to ensure fresh routing on next use.
Sourcepub fn unbind(&self, dest: &Reference)
pub fn unbind(&self, dest: &Reference)
Removes all address mappings with the given prefix from the router.
Also evicts any corresponding cached senders to prevent reuse of stale connections.
Sourcepub fn lookup_addr(&self, actor_id: &ActorId) -> Option<ChannelAddr>
pub fn lookup_addr(&self, actor_id: &ActorId) -> Option<ChannelAddr>
Lookup an actor’s channel in the router’s address bok.
Trait Implementations§
Source§impl Clone for DialMailboxRouter
impl Clone for DialMailboxRouter
Source§fn clone(&self) -> DialMailboxRouter
fn clone(&self) -> DialMailboxRouter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DialMailboxRouter
impl Debug for DialMailboxRouter
Source§impl Default for DialMailboxRouter
impl Default for DialMailboxRouter
Source§impl MailboxSender for DialMailboxRouter
impl MailboxSender for DialMailboxRouter
Source§fn post_unchecked(
&self,
envelope: MessageEnvelope,
return_handle: PortHandle<Undeliverable<MessageEnvelope>>,
)
fn post_unchecked( &self, envelope: MessageEnvelope, return_handle: PortHandle<Undeliverable<MessageEnvelope>>, )
Source§fn post(
&self,
envelope: MessageEnvelope,
return_handle: PortHandle<Undeliverable<MessageEnvelope>>,
)
fn post( &self, envelope: MessageEnvelope, return_handle: PortHandle<Undeliverable<MessageEnvelope>>, )
Auto Trait Implementations§
impl Freeze for DialMailboxRouter
impl !RefUnwindSafe for DialMailboxRouter
impl Send for DialMailboxRouter
impl Sync for DialMailboxRouter
impl Unpin for DialMailboxRouter
impl !UnwindSafe for DialMailboxRouter
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
Source§impl<T> BoxableMailboxSender for Twhere
T: MailboxSender + Clone + 'static,
impl<T> BoxableMailboxSender for Twhere
T: MailboxSender + Clone + 'static,
Source§fn boxed(&self) -> BoxedMailboxSender
fn boxed(&self) -> BoxedMailboxSender
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoBoxedMailboxSender for Twhere
T: MailboxSender + 'static,
impl<T> IntoBoxedMailboxSender for Twhere
T: MailboxSender + 'static,
Source§fn into_boxed(self) -> BoxedMailboxSender
fn into_boxed(self) -> BoxedMailboxSender
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more