[][src]Trait riker::actor::CellInternal

pub trait CellInternal {
    type Msg: Message;
    fn dead_letters(&self) -> &ActorRef<Self::Msg>;
fn persistence_conf(&self) -> Option<PersistenceConf>;
fn is_persisting(&self) -> bool;
fn set_persisting(&self, b: bool);
fn identify(&self, sender: Option<ActorRef<Self::Msg>>);
fn add_child(&self, name: &str, actor: ActorRef<Self::Msg>);
fn stop(&self, actor: ActorRef<Self::Msg>);
fn receive_cmd(
        &self,
        cmd: ActorCmd,
        actor: &mut Option<BoxActor<Self::Msg>>
    );
fn terminate(&self, actor: &mut Option<BoxActor<Self::Msg>>);
fn restart(&self);
fn death_watch(
        &self,
        terminated: &ActorRef<Self::Msg>,
        actor: &mut Option<BoxActor<Self::Msg>>
    );
fn handle_failure(&self, failed: ActorRef<Self::Msg>, strategy: Strategy);
fn restart_child(&self, actor: ActorRef<Self::Msg>);
fn escalate_failure(&self);
fn is_child(&self, actor: &ActorRef<Self::Msg>) -> bool;
fn load_events(&self, actor: &mut Option<BoxActor<Self::Msg>>) -> bool;
fn replay(
        &self,
        ctx: &Context<Self::Msg>,
        evts: Vec<Self::Msg>,
        actor: &mut Option<BoxActor<Self::Msg>>
    ); }

ActorCell internal API.

This trait is used by the internal system to provode control over Actor and ActorCell

Associated Types

type Msg: Message

Loading content...

Required methods

fn dead_letters(&self) -> &ActorRef<Self::Msg>

Return the system's dead letters reference.

fn persistence_conf(&self) -> Option<PersistenceConf>

Return the actor's persistence configuration.

fn is_persisting(&self) -> bool

Returns true if the actor is currently in a state of persisting.

fn set_persisting(&self, b: bool)

Sets the persisting status of the actor.

This signals to the actor's mailbox to defer processing of messages until the event store completes storing the event.

fn identify(&self, sender: Option<ActorRef<Self::Msg>>)

Invoked when an actor receives an Identify message.

message. An Info message must be sent to the sender, with the sender of the message set to myself.

fn add_child(&self, name: &str, actor: ActorRef<Self::Msg>)

Adds a child under this actor.

fn stop(&self, actor: ActorRef<Self::Msg>)

Send an ActorCmd::Stop to the given actor.

fn receive_cmd(&self, cmd: ActorCmd, actor: &mut Option<BoxActor<Self::Msg>>)

Invoked when the actor receives a command.

Possible commands:

  • Stop: attempt to terminate the actor
  • Restart: attempt to restart the actor

fn terminate(&self, actor: &mut Option<BoxActor<Self::Msg>>)

Terminate the actor associated with this ActorCell.

If the actor has no children then the kernel is instructed to terminate the actor immediately.

If the actor has children then each child is sent a stop command and the actor is placed in a 'terminating' state. When the actor is notified of each child's termination it checks to see if there are no more children so it can safely stop itself.

Does not block.

fn restart(&self)

Restart the actor associated with this ActorCell

If the actor has no children then the kernel is instructed to restart the actor immediately.

If the actor has children then each child is sent a stop command and the actor is placed in a 'restarting' state. When the actor is notified of each child's termination it checks to see if there are no more children so it can safely restart itself.

Does not block.

fn death_watch(
    &self,
    terminated: &ActorRef<Self::Msg>,
    actor: &mut Option<BoxActor<Self::Msg>>
)

Invoked when a child actor is terminated.

Each time an actor is stopped, either manually or as part of supervision, its parent is notified.

If the actor is in a state of terminating or restarting it will check to see if those operations can be completed after all children have been terminated.

fn handle_failure(&self, failed: ActorRef<Self::Msg>, strategy: Strategy)

Invoked when a child actor fails (panics).

The provided supervision strategy will be executed.

fn restart_child(&self, actor: ActorRef<Self::Msg>)

Invoked when the supervision strategy restarts a child actor.

fn escalate_failure(&self)

Invoked when the supervision strategy escalates an actor's failure.

fn is_child(&self, actor: &ActorRef<Self::Msg>) -> bool

fn load_events(&self, actor: &mut Option<BoxActor<Self::Msg>>) -> bool

Invoked to query an actor's events during actor start.

If an actor has persistence configured its events are queried from the data store and sent to the actor to complete actor initialization.

Must not block.

fn replay(
    &self,
    ctx: &Context<Self::Msg>,
    evts: Vec<Self::Msg>,
    actor: &mut Option<BoxActor<Self::Msg>>
)

Invoked during actor start to complete actor initialization.

Applies only in the case where persistence is configured.

replay is called when the event store query, created in load_events has completed and the values are available.

Loading content...

Implementors

impl<Msg> CellInternal for ActorCell<Msg> where
    Msg: Message
[src]

type Msg = Msg

Loading content...