pub struct ActorSystem {
pub exec: ThreadPool,
pub timer: Sender<Job>,
pub sys_channels: Option<SysChannels>,
/* private fields */
}Expand description
The actor runtime and common services coordinator
The ActorSystem provides a runtime on which actors are executed.
It also provides common services such as channels, persistence
and scheduling. The ActorSystem is the heart of a Riker application,
starting serveral threads when it is created. Create only one instance
of ActorSystem per application.
Fields§
§exec: ThreadPool§timer: Sender<Job>§sys_channels: Option<SysChannels>Implementations§
Source§impl ActorSystem
impl ActorSystem
Sourcepub fn new() -> Result<Self, SystemError>
pub fn new() -> Result<Self, SystemError>
Create a new ActorSystem instance
Requires a type that implements the Model trait.
Sourcepub fn with_name(name: &str) -> Result<Self, SystemError>
pub fn with_name(name: &str) -> Result<Self, SystemError>
Create a new ActorSystem instance with provided name
Requires a type that implements the Model trait.
Sourcepub fn with_config(name: &str, cfg: &Config) -> Result<Self, SystemError>
pub fn with_config(name: &str, cfg: &Config) -> Result<Self, SystemError>
Create a new ActorSystem instance bypassing default config behavior
Sourcepub fn host(&self) -> Arc<String>
pub fn host(&self) -> Arc<String>
Returns the hostname used when the system started
The host is used in actor addressing.
Currently not used, but will be once system clustering is introduced.
pub fn print_tree(&self)
pub fn get_tree(&self) -> String
Sourcepub fn user_root(&self) -> &BasicActorRef
pub fn user_root(&self) -> &BasicActorRef
Returns the system root’s actor reference Returns the user root actor reference
Sourcepub fn sys_root(&self) -> &BasicActorRef
pub fn sys_root(&self) -> &BasicActorRef
Returns the system root actor reference
Sourcepub fn temp_root(&self) -> &BasicActorRef
pub fn temp_root(&self) -> &BasicActorRef
Reutrns the temp root actor reference
Sourcepub fn sys_events(&self) -> &ActorRef<ChannelMsg<SystemEvent>>
pub fn sys_events(&self) -> &ActorRef<ChannelMsg<SystemEvent>>
Returns a reference to the system events channel
Sourcepub fn dead_letters(&self) -> &ActorRef<DLChannelMsg>
pub fn dead_letters(&self) -> &ActorRef<DLChannelMsg>
Returns a reference to the dead letters channel
pub fn publish_event(&self, evt: SystemEvent)
Sourcepub fn sys_actor_of_props<A>(
&self,
props: BoxActorProd<A>,
name: &str,
) -> Result<ActorRef<A::Msg>, CreateError>where
A: Actor,
pub fn sys_actor_of_props<A>(
&self,
props: BoxActorProd<A>,
name: &str,
) -> Result<ActorRef<A::Msg>, CreateError>where
A: Actor,
Create an actor under the system root
pub fn sys_actor_of<A>(
&self,
name: &str,
) -> Result<ActorRef<<A as Actor>::Msg>, CreateError>where
A: ActorFactory,
pub fn sys_actor_of_args<A, Args>(
&self,
name: &str,
args: Args,
) -> Result<ActorRef<<A as Actor>::Msg>, CreateError>where
Args: ActorArgs,
A: ActorFactoryArgs<Args>,
pub fn log(&self) -> Logger
Sourcepub fn when_terminated(&self) -> Terminated
pub fn when_terminated(&self) -> Terminated
Returns a future which is completed when all actors have successfully stopped.
Note! In the current implementation the future will not complete if root actor is already terminated.
Trait Implementations§
Source§impl ActorRefFactory for ActorSystem
impl ActorRefFactory for ActorSystem
fn actor_of_props<A>(
&self,
props: BoxActorProd<A>,
name: &str,
) -> Result<ActorRef<A::Msg>, CreateError>where
A: Actor,
fn actor_of<A>(
&self,
name: &str,
) -> Result<ActorRef<<A as Actor>::Msg>, CreateError>where
A: ActorFactory,
fn actor_of_args<A, Args>(
&self,
name: &str,
args: Args,
) -> Result<ActorRef<<A as Actor>::Msg>, CreateError>where
Args: ActorArgs,
A: ActorFactoryArgs<Args>,
fn stop(&self, actor: impl ActorReference)
Source§impl ActorSelectionFactory for ActorSystem
impl ActorSelectionFactory for ActorSystem
Source§impl Clone for ActorSystem
impl Clone for ActorSystem
Source§fn clone(&self) -> ActorSystem
fn clone(&self) -> ActorSystem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more