pub struct InMemoryAgentRegistry { /* private fields */ }Expand description
In-memory AgentRegistry adapter — the default, infra-free implementation.
A first-class type (not test-only, per hex rule 6): services and tests run
against it without standing up external infrastructure. Cheap to clone
(shares one map); reads (find_by_skill, get) dominate writes, hence the
RwLock.
Implementations§
Trait Implementations§
Source§impl AgentRegistry for InMemoryAgentRegistry
impl AgentRegistry for InMemoryAgentRegistry
Source§fn register<'life0, 'async_trait>(
&'life0 self,
card: AgentCard,
endpoint: String,
) -> Pin<Box<dyn Future<Output = Result<AgentId, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register<'life0, 'async_trait>(
&'life0 self,
card: AgentCard,
endpoint: String,
) -> Pin<Box<dyn Future<Output = Result<AgentId, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Register (or replace) an agent. The id is derived from the card’s name;
re-registering the same name upserts (last-writer-wins). Read more
Source§fn mark<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AgentId,
liveness: Liveness,
) -> Pin<Box<dyn Future<Output = Result<(), RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AgentId,
liveness: Liveness,
) -> Pin<Box<dyn Future<Output = Result<(), RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Record what a liveness probe found. Returns
RegistryError::NotFound
if the agent was deregistered while the probe was in flight.Source§fn deregister<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<(), RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn deregister<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<(), RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove an agent. Returns
RegistryError::NotFound if it was not
registered.Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<Option<RegisteredAgent>, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AgentId,
) -> Pin<Box<dyn Future<Output = Result<Option<RegisteredAgent>, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Look up an agent by id;
Ok(None) when absent.Source§fn find_by_skill<'life0, 'life1, 'async_trait>(
&'life0 self,
skill: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisteredAgent>, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn find_by_skill<'life0, 'life1, 'async_trait>(
&'life0 self,
skill: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisteredAgent>, RegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Find every agent whose card advertises a matching skill. A skill matches
when its
id or any of its tags equals skill, case-insensitively. Read moreSource§impl Clone for InMemoryAgentRegistry
impl Clone for InMemoryAgentRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryAgentRegistry
impl !UnwindSafe for InMemoryAgentRegistry
impl Freeze for InMemoryAgentRegistry
impl Send for InMemoryAgentRegistry
impl Sync for InMemoryAgentRegistry
impl Unpin for InMemoryAgentRegistry
impl UnsafeUnpin for InMemoryAgentRegistry
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
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> ⓘ
Converts
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> ⓘ
Converts
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