pub struct LeanWorkerPool { /* private fields */ }Expand description
Local pool for worker-backed capability sessions.
Implementations§
Source§impl LeanWorkerPool
impl LeanWorkerPool
Sourcepub fn new(config: LeanWorkerPoolConfig) -> Self
pub fn new(config: LeanWorkerPoolConfig) -> Self
Create an empty local worker pool.
Sourcepub fn acquire_lease(
&mut self,
builder: LeanWorkerCapabilityBuilder,
) -> Result<LeanWorkerSessionLease<'_>, LeanWorkerError>
pub fn acquire_lease( &mut self, builder: LeanWorkerCapabilityBuilder, ) -> Result<LeanWorkerSessionLease<'_>, LeanWorkerError>
Acquire a lease for the capability described by builder.
The pool reuses a warm compatible worker session when possible. If a
matching worker has died, the pool replaces it before returning the
lease. If admitting a distinct session key would exceed max_workers,
the pool returns LeanWorkerError::WorkerPoolExhausted.
§Errors
Returns LeanWorkerError when the capability cannot be built, metadata
validation fails, a dead compatible worker cannot be replaced, or the
fixed local worker limit is already full of distinct session keys.
Sourcepub fn snapshot(&self) -> LeanWorkerPoolSnapshot
pub fn snapshot(&self) -> LeanWorkerPoolSnapshot
Return a public snapshot of pool state.
Trait Implementations§
Source§impl Debug for LeanWorkerPool
impl Debug for LeanWorkerPool
Auto Trait Implementations§
impl Freeze for LeanWorkerPool
impl RefUnwindSafe for LeanWorkerPool
impl Send for LeanWorkerPool
impl Sync for LeanWorkerPool
impl Unpin for LeanWorkerPool
impl UnsafeUnpin for LeanWorkerPool
impl UnwindSafe for LeanWorkerPool
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