[][src]Enum kompact::prelude::ActorPath

#[repr(u8)]pub enum ActorPath {
    Unique(UniquePath),
    Named(NamedPath),
}

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]

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]

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]

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]

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]

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]

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]

impl FromStr for ActorPath[src]

type Err = PathParseError

The associated error which can be returned from parsing.

impl Hash for ActorPath[src]

impl Ord for ActorPath[src]

impl PartialEq<ActorPath> for ActorPath[src]

impl PartialOrd<ActorPath> for ActorPath[src]

impl Serialisable for ActorPath[src]

fn serialise(&self, buf: &mut dyn BufMut) -> Result<(), SerError>[src]

Serializes a Unique or Named actor path.

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]

impl TryFrom<String> for ActorPath[src]

type Error = PathParseError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<K> TrieKey for K where
    K: Eq + Hash + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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