pub struct AgentPool { /* private fields */ }Expand description
Pool of reusable agent handles.
Manages a collection of spawned agents with checkout/release semantics. Idle agents are kept warm for reuse rather than being terminated.
Implementations§
Source§impl AgentPool
impl AgentPool
Sourcepub fn with_shutdown_grace(self, grace: Duration) -> Self
pub fn with_shutdown_grace(self, grace: Duration) -> Self
Set the grace period for shutting down evicted agents.
Sourcepub fn checkout(&mut self, provider_id: &str) -> Option<AgentHandle>
pub fn checkout(&mut self, provider_id: &str) -> Option<AgentHandle>
Return an idle agent for the given provider, if one is available.
Sourcepub fn release(&mut self, handle: AgentHandle)
pub fn release(&mut self, handle: AgentHandle)
Return an agent to the pool for reuse.
If the pool for this provider is full, the oldest agent is evicted (shutdown gracefully in the background).
Sourcepub fn idle_count(&self, provider_id: &str) -> usize
pub fn idle_count(&self, provider_id: &str) -> usize
Number of idle agents for a given provider.
Sourcepub fn total_idle(&self) -> usize
pub fn total_idle(&self) -> usize
Total idle agents across all providers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentPool
impl !RefUnwindSafe for AgentPool
impl Send for AgentPool
impl Sync for AgentPool
impl Unpin for AgentPool
impl UnsafeUnpin for AgentPool
impl !UnwindSafe for AgentPool
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