pub struct ActorRegistry { /* private fields */ }Expand description
Actor registry for tracking actors.
Implementations§
Source§impl ActorRegistry
impl ActorRegistry
Sourcepub fn with_mailbox_config(config: MailboxConfig) -> Self
pub fn with_mailbox_config(config: MailboxConfig) -> Self
Create a new registry with custom mailbox config.
Sourcepub fn register_named(
&self,
id: ActorId,
name: Option<String>,
) -> Result<Arc<Mailbox>>
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.
Sourcepub fn unregister(&self, id: &ActorId) -> Result<()>
pub fn unregister(&self, id: &ActorId) -> Result<()>
Unregister an actor.
Sourcepub fn get_state(&self, id: &ActorId) -> Option<ActorState>
pub fn get_state(&self, id: &ActorId) -> Option<ActorState>
Get an actor’s state by ID.
Sourcepub fn lookup_mailbox(&self, name: &str) -> Option<Arc<Mailbox>>
pub fn lookup_mailbox(&self, name: &str) -> Option<Arc<Mailbox>>
Look up an actor’s mailbox by name.
Sourcepub fn record_processed(&self, id: &ActorId)
pub fn record_processed(&self, id: &ActorId)
Record a message processed by an actor.
Sourcepub fn get_processed_count(&self, id: &ActorId) -> u64
pub fn get_processed_count(&self, id: &ActorId) -> u64
Get the number of messages processed by an actor.
Sourcepub fn get_last_active(&self, id: &ActorId) -> Option<i64>
pub fn get_last_active(&self, id: &ActorId) -> Option<i64>
Get the last activity timestamp for an actor.
Sourcepub fn list_actors(&self) -> Vec<ActorId>
pub fn list_actors(&self) -> Vec<ActorId>
List all actor IDs.
Sourcepub fn list_by_state(&self, state: ActorState) -> Vec<ActorId>
pub fn list_by_state(&self, state: ActorState) -> Vec<ActorId>
List actors by state.
Sourcepub fn stats(&self) -> RegistryStats
pub fn stats(&self) -> RegistryStats
Get statistics about the registry.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ActorRegistry
impl !RefUnwindSafe for ActorRegistry
impl Send for ActorRegistry
impl Sync for ActorRegistry
impl Unpin for ActorRegistry
impl UnsafeUnpin for ActorRegistry
impl UnwindSafe for ActorRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more