pub struct AgentRegistry { /* private fields */ }Expand description
Agent identity registry.
Cheap to clone — the inner map is wrapped in Arc/DashMap.
Indexed by both agent_id (UUID) and registration name so
multi-tenant chat can lazily get_or_register a per-caller
principal (WEFT-332) without minting a new UUID every turn.
Implementations§
Source§impl AgentRegistry
impl AgentRegistry
Sourcepub fn register(&self, name: String, pubkey: [u8; 32]) -> RegisteredAgent
pub fn register(&self, name: String, pubkey: [u8; 32]) -> RegisteredAgent
Register a new agent with the given name and public key.
Returns the freshly-minted agent_id. This function does not
verify the proof-of-possession — the caller (daemon RPC
handler) does that against register_payload before calling
this method.
Always mints a new UUID even if name was previously
registered (legacy agent.register RPC semantics). For
idempotent multi-tenant principals prefer
Self::get_or_register.
Sourcepub fn get(&self, agent_id: &str) -> Option<RegisteredAgent>
pub fn get(&self, agent_id: &str) -> Option<RegisteredAgent>
Look up an agent by id.
Sourcepub fn get_by_name(&self, name: &str) -> Option<RegisteredAgent>
pub fn get_by_name(&self, name: &str) -> Option<RegisteredAgent>
Look up the first agent registered under name.
Sourcepub fn get_or_register(&self, name: String, pubkey: [u8; 32]) -> RegisteredAgent
pub fn get_or_register(&self, name: String, pubkey: [u8; 32]) -> RegisteredAgent
Return the existing principal for name, or register a new
one (WEFT-332 multi-tenant chat).
Idempotent for a given name: concurrent callers that lose the insert race re-read the winner so only one UUID is live.
Sourcepub fn list(&self) -> Vec<RegisteredAgent>
pub fn list(&self) -> Vec<RegisteredAgent>
List all registered agents.
Trait Implementations§
Source§impl Clone for AgentRegistry
impl Clone for AgentRegistry
Source§impl Debug for AgentRegistry
impl Debug for AgentRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for AgentRegistry
impl !UnwindSafe for AgentRegistry
impl Freeze for AgentRegistry
impl Send for AgentRegistry
impl Sync for AgentRegistry
impl Unpin for AgentRegistry
impl UnsafeUnpin for AgentRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more