[−][src]Enum kompact::prelude::ActorPath
An actor path is a serialisable, possibly remote reference to an actor
Any message sent via an actor path might go over the network, and must be treated as fallible. It must also be serialisable.
Variants
Unique(UniquePath)
A unique actor path identifies a concrete instance of an actor
Unique actor paths use the component's unique id internally.
Unique actor paths become invalid when a component is replaced with a new instance of the same type.
A unique path may look something like "tcp://127.0.0.1:8080#1e555f40-de1d-4aee-8202-64fdc27edfa8"
, for example.
Named(NamedPath)
A named actor path identifies a service, rather than a concrete actor instance
Named paths must be registered to a particular actor, and their registration can be changed over time, as actors fail and are replaced, for example.
Named paths may be described hierarchically, similar to URLs.
A named path may look something like "tcp://127.0.0.1:8080/my-actor-group/my-actor"
, for example.
Methods
impl ActorPath
[src]
pub fn tell<S, B>(&self, m: B, from: &S) where
S: ActorSource,
B: Into<Box<dyn Serialisable>>,
[src]
S: ActorSource,
B: Into<Box<dyn Serialisable>>,
Send message m
to the actor designated by this path
The from
field is used as a source,
and the ActorPath
it resolved to will be supplied at the destination.
Serialisation of m
happens lazily in the dispatcher,
and only if it really goes over the network. If this actor path
turns out to be local, m
will be moved to the heap and send locally instead.
In fact, this method always moves m
onto the heap (unless it already is allocated there),
to facility this lazy serialisation.
As this method has some overhead in the case where it sure
that m
will definitely go over the network, you can use
tell_serialised to force eager serialisation instead.
pub fn tell_serialised<CD, B>(&self, m: B, from: &CD) -> Result<(), SerError> where
CD: ComponentDefinition + Sized + 'static,
B: Serialisable + 'static,
[src]
CD: ComponentDefinition + Sized + 'static,
B: Serialisable + 'static,
Same as tell, but serialises eagerly into a Pooled buffer (pre-allocated and bounded)
pub fn forward_with_original_sender<D>(
&self,
serialised_message: NetMessage,
dispatcher: &D
) where
D: Dispatching,
[src]
&self,
serialised_message: NetMessage,
dispatcher: &D
) where
D: Dispatching,
Forwards the still serialised message to this path without changing the sender
This can be used for routing protocls where the final recipient is supposed to reply to the original sender, not the intermediaries.
pub fn forward_with_sender<CD>(&self, serialised_message: NetMessage, from: &CD) where
CD: ComponentDefinition + Sized + 'static,
[src]
CD: ComponentDefinition + Sized + 'static,
Forwards the still serialised message to this path replacing the sender with the given one
pub fn using_dispatcher<'a, 'b>(
&'a self,
disp: &'b dyn Dispatching
) -> DispatchingPath<'a, 'b>
[src]
&'a self,
disp: &'b dyn Dispatching
) -> DispatchingPath<'a, 'b>
Returns a temporary combination of an ActorPath and something that can dispatch stuff
This can be used when you want to use a different actor path than the one of the current component for a tell but still need to use the component's dispatcher for the message. This is useful for forwarding components, for example, when trying to preserve the original sender.
pub fn set_transport(&mut self, proto: Transport)
[src]
Change the transport protocol for this actor path
Trait Implementations
impl Clone for ActorPath
[src]
impl Debug for ActorPath
[src]
impl Deserialiser<ActorPath> for ActorPath
[src]
impl<'de> Deserialize<'de> for ActorPath
[src]
fn deserialize<D>(deserializer: D) -> Result<ActorPath, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for ActorPath
[src]
impl Eq for ActorPath
[src]
impl From<(SystemPath, Uuid)> for ActorPath
[src]
impl From<NamedPath> for ActorPath
[src]
impl From<UniquePath> for ActorPath
[src]
fn from(p: UniquePath) -> ActorPath
[src]
impl FromStr for ActorPath
[src]
type Err = PathParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for ActorPath
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for ActorPath
[src]
fn cmp(&self, other: &ActorPath) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<ActorPath> for ActorPath
[src]
impl PartialOrd<ActorPath> for ActorPath
[src]
fn partial_cmp(&self, other: &ActorPath) -> Option<Ordering>
[src]
fn lt(&self, other: &ActorPath) -> bool
[src]
fn le(&self, other: &ActorPath) -> bool
[src]
fn gt(&self, other: &ActorPath) -> bool
[src]
fn ge(&self, other: &ActorPath) -> bool
[src]
impl Serialisable for ActorPath
[src]
fn ser_id(&self) -> SerId
[src]
fn size_hint(&self) -> Option<usize>
[src]
fn serialise(&self, buf: &mut dyn BufMut) -> Result<(), SerError>
[src]
Serializes a Unique or Named actor path.
fn local(self: Box<Self>) -> Result<Box<dyn Any + Send>, Box<dyn Serialisable>>
[src]
fn serialised(&self) -> Result<Serialised, SerError>
[src]
impl SerialisationId for ActorPath
[src]
impl Serialize for ActorPath
[src]
impl StructuralEq for ActorPath
[src]
impl StructuralPartialEq for ActorPath
[src]
impl SystemField for ActorPath
[src]
fn system(&self) -> &SystemPath
[src]
fn protocol(&self) -> Transport
[src]
fn address(&self) -> &IpAddr
[src]
fn port(&self) -> u16
[src]
impl TryFrom<String> for ActorPath
[src]
Auto Trait Implementations
impl RefUnwindSafe for ActorPath
impl Send for ActorPath
impl Sync for ActorPath
impl Unpin for ActorPath
impl UnwindSafe for ActorPath
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<K> TrieKey for K where
K: Eq + Hash + ?Sized,
[src]
K: Eq + Hash + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,