[][src]Struct kay::ActorSystem

pub struct ActorSystem {
    pub panic_happened: bool,
    // some fields omitted
}

Contains the state of a whole actor system and can be used for managing and progressing the actor system as well as for interacting with it from the outside

Fields

panic_happened: bool

Did a panic happen inside a message handler? If so, only messages marked as Critical are still sent.

Methods

impl ActorSystem[src]

pub fn new(networking: Networking, tuning: Tuning) -> ActorSystem[src]

Create a new actor system that lives in memory only

pub fn new_mmap_persisted<P: AsRef<Path>>(
    networking: Networking,
    directory: &P,
    tuning: Tuning
) -> ActorSystem
[src]

Create a new actor system that lives in memory and is persisted to disk using Mmapping

pub fn new_with_storage(
    networking: Networking,
    storage: Rc<dyn ChunkStorage>,
    tuning: Tuning
) -> ActorSystem
[src]

Create a new actor system backed by any chunky::ChunkStorage

pub fn register<A: Actor>(&mut self)[src]

Register a new actor class with the system (assigning it a type ID)

pub fn register_dummy<D: 'static>(&mut self)[src]

Register a dummy actor class without allocating any resources or dispatchers. This can be used to get consistent type ID assignment between different interacting versions of an actor system, where some actor classes might only ever exist in some versions.

pub fn register_trait<T: ActorOrActorTrait>(&mut self)[src]

Register a new actor trait with the system

pub fn register_trait_message<M: Message>(&mut self)[src]

Register a message that an actor trait handles

pub fn register_implementor<A: Actor, T: ActorOrActorTrait>(&mut self)[src]

Register an actor class as an implementor of an actor trait, makes it receive messages that are broadcast to the actor trait ID.

pub fn add_handler<A: Actor, M: Message, F: Fn(&M, &mut A, &mut World) -> Fate + 'static>(
    &mut self,
    handler: F,
    critical: bool
)
[src]

Add a message handler to a registered actor class

pub fn add_spawner<A: Actor, M: Message, F: Fn(&M, &mut World) -> A + 'static>(
    &mut self,
    constructor: F,
    critical: bool
)
[src]

Add an actor spawner to a registered actor class

pub fn send<M: Message>(&mut self, recipient: RawID, message: M)[src]

Manually send a message

pub fn id<A: ActorOrActorTrait>(&mut self) -> RawID[src]

Get a base RawID for an actor or actor trait

pub fn process_all_messages(&mut self)[src]

Process and handle all enqueued messages in the system and the resulting messages, up to a recursion depth of 1000

pub fn world(&mut self) -> World[src]

Get a World handle for the system.

pub fn networking_connect(&mut self)[src]

Connect to peers in the networking topology.

pub fn networking_send_and_receive(&mut self)[src]

Send and receive messages from peers in the networking topology.

pub fn networking_finish_turn(&mut self) -> Option<usize>[src]

Mark the local "networking turn" as finished. Networking turns are used to track and manage time drift between peers in the networking topology.

pub fn networking_machine_id(&self) -> MachineID[src]

Get the machine ID of this system in the network

pub fn networking_n_turns(&self) -> usize[src]

Get the local number of networking turns

pub fn networking_debug_all_n_turns(&self) -> HashMap<MachineID, isize>[src]

Get a summary of the local view of the networking turn state of all connected peers.

pub fn get_instance_counts(&self) -> HashMap<String, usize>[src]

Get local instance counts of each actor class

pub fn get_message_statistics(&self) -> HashMap<String, usize>[src]

Get statistics of sent messages per type

pub fn reset_message_statistics(&mut self)[src]

Reset the counter for message statistics

pub fn get_queue_lengths(&self) -> HashMap<String, usize>[src]

Get the current length of all actor message queues

pub fn get_actor_type_id_to_name_mapping(&self) -> HashMap<u16, String>[src]

Get a mapping from actor type IDs to full names, for debugging.

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> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.