pub struct ActorRegistry {
entries: HashMap<String, RegistryEntry>,
reverse: HashMap<KernelId, Vec<String>>,
watchers: Vec<(String, Vec<RegistryEvent>)>,
}Expand description
Global actor registry with symbolic names.
Provides service discovery for the actor system: LLM tool calls, external APIs, and inter-actor routing can find actors by name instead of opaque kernel IDs.
Fields§
§entries: HashMap<String, RegistryEntry>Name → Entry mapping.
reverse: HashMap<KernelId, Vec<String>>Reverse mapping: KernelId → names (one kernel can have multiple names).
watchers: Vec<(String, Vec<RegistryEvent>)>Watchers: pattern → callback channels.
Implementations§
Source§impl ActorRegistry
impl ActorRegistry
Sourcepub fn register(
&mut self,
name: impl Into<String>,
kernel_id: KernelId,
) -> RegistryEvent
pub fn register( &mut self, name: impl Into<String>, kernel_id: KernelId, ) -> RegistryEvent
Register an actor by name.
If the name is already registered, updates the mapping and
emits an Updated event.
Register with metadata tags.
Sourcepub fn deregister(&mut self, name: &str) -> Option<RegistryEvent>
pub fn deregister(&mut self, name: &str) -> Option<RegistryEvent>
Deregister an actor by name.
Sourcepub fn deregister_kernel(&mut self, kernel_id: &KernelId) -> Vec<RegistryEvent>
pub fn deregister_kernel(&mut self, kernel_id: &KernelId) -> Vec<RegistryEvent>
Deregister all names associated with a kernel ID.
Sourcepub fn lookup_entry(&self, name: &str) -> Option<&RegistryEntry>
pub fn lookup_entry(&self, name: &str) -> Option<&RegistryEntry>
Lookup the full registry entry by name.
Sourcepub fn names_for(&self, kernel_id: &KernelId) -> Vec<&str>
pub fn names_for(&self, kernel_id: &KernelId) -> Vec<&str>
Lookup all names registered to a kernel ID.
Sourcepub fn lookup_pattern(&self, pattern: &str) -> Vec<(&str, &KernelId)>
pub fn lookup_pattern(&self, pattern: &str) -> Vec<(&str, &KernelId)>
Lookup actors by wildcard pattern.
Supports:
*matches any sequence of characters (excluding/)**matches any sequence including/?matches a single character
Examples:
"standards/*"matches"standards/isa"but not"standards/isa/500""standards/**"matches"standards/isa/500""isa_*"matches"isa_ontology","isa_rules"
Sourcepub fn list_names(&self) -> Vec<&str>
pub fn list_names(&self) -> Vec<&str>
List all registered names.
Sourcepub fn watch(&mut self, pattern: impl Into<String>) -> usize
pub fn watch(&mut self, pattern: impl Into<String>) -> usize
Add a watcher for registry changes.
Returns a watcher ID that can be used to retrieve events.
Sourcepub fn drain_events(&mut self, watcher_id: usize) -> Vec<RegistryEvent>
pub fn drain_events(&mut self, watcher_id: usize) -> Vec<RegistryEvent>
Drain events for a watcher.