Skip to main content

ActorRegistry

Struct ActorRegistry 

Source
pub struct ActorRegistry { /* private fields */ }
Expand description

Actor registry for tracking actors.

Implementations§

Source§

impl ActorRegistry

Source

pub fn new() -> Self

Create a new actor registry.

Source

pub fn with_mailbox_config(config: MailboxConfig) -> Self

Create a new registry with custom mailbox config.

Source

pub fn register(&self, id: ActorId) -> Result<Arc<Mailbox>>

Register a new actor.

Source

pub fn register_named( &self, id: ActorId, name: Option<String>, ) -> Result<Arc<Mailbox>>

Register a new actor with a name.

This operation is fully atomic: both the ID and name mappings are created (or rejected) under a single critical section. The by_name write lock serializes all registrations, preventing TOCTOU races where a concurrent registration could observe or corrupt partial state.

Source

pub fn unregister(&self, id: &ActorId) -> Result<()>

Unregister an actor.

Source

pub fn get_mailbox(&self, id: &ActorId) -> Option<Arc<Mailbox>>

Get an actor’s mailbox by ID.

Source

pub fn get_state(&self, id: &ActorId) -> Option<ActorState>

Get an actor’s state by ID.

Source

pub fn set_state(&self, id: &ActorId, state: ActorState) -> Result<()>

Set an actor’s state.

Source

pub fn lookup(&self, name: &str) -> Option<ActorId>

Look up an actor by name.

Source

pub fn lookup_mailbox(&self, name: &str) -> Option<Arc<Mailbox>>

Look up an actor’s mailbox by name.

Source

pub fn record_processed(&self, id: &ActorId)

Record a message processed by an actor.

Source

pub fn get_processed_count(&self, id: &ActorId) -> u64

Get the number of messages processed by an actor.

Source

pub fn get_last_active(&self, id: &ActorId) -> Option<i64>

Get the last activity timestamp for an actor.

Source

pub fn len(&self) -> usize

Get the total number of actors.

Source

pub fn is_empty(&self) -> bool

Check if the registry is empty.

Source

pub fn list_actors(&self) -> Vec<ActorId>

List all actor IDs.

Source

pub fn list_by_state(&self, state: ActorState) -> Vec<ActorId>

List actors by state.

Source

pub fn stats(&self) -> RegistryStats

Get statistics about the registry.

Trait Implementations§

Source§

impl Default for ActorRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more