pub struct LeanWorkerPoolConfig { /* private fields */ }Expand description
Configuration for a local LeanWorkerPool.
Long-running hosts should configure the worker count, total child RSS
budget, per-worker RSS ceiling, and each worker’s
LeanWorkerRestartPolicy together. The pool admits cold distinct session
keys; the worker restart policy bounds retained Lean state inside an
admitted child.
Implementations§
Source§impl LeanWorkerPoolConfig
impl LeanWorkerPoolConfig
Sourcepub fn new(max_workers: usize) -> Self
pub fn new(max_workers: usize) -> Self
Create pool configuration with a fixed local worker limit.
max_workers is clamped to at least one. Production callers should
normally add Self::max_total_child_rss_kib and
Self::per_worker_rss_ceiling_kib rather than relying on the worker
count alone.
Sourcepub fn max_workers(&self) -> usize
pub fn max_workers(&self) -> usize
Return the maximum number of local child workers the pool may own.
Sourcepub fn max_total_child_rss_kib(self, limit: u64) -> Self
pub fn max_total_child_rss_kib(self, limit: u64) -> Self
Reject new distinct workers when known total child RSS reaches limit.
RSS sampling is best effort. On platforms where the pool cannot obtain
samples, it records unavailable samples and does not make a false
admission claim. Size this with the worker count; for example, a host
that admits n children under a per-worker cap should normally set this
to n * per_worker_rss_ceiling_kib.
Sourcepub fn per_worker_rss_ceiling_kib(self, limit: u64) -> Self
pub fn per_worker_rss_ceiling_kib(self, limit: u64) -> Self
Cycle a worker before assigning work when its sampled RSS reaches limit.
This is the pool-side assignment guard. The worker’s own
LeanWorkerRestartPolicy::memory_bounded should use a compatible RSS
cap so fresh import-like requests are checked before entering the child.
Sourcepub fn idle_cycle_after(self, limit: Duration) -> Self
pub fn idle_cycle_after(self, limit: Duration) -> Self
Cycle an idle worker before assigning more work through an old lease.
Sourcepub fn queue_wait_timeout(self, timeout: Duration) -> Self
pub fn queue_wait_timeout(self, timeout: Duration) -> Self
Wait this long for local pool admission before returning a typed error.
The current pool is synchronous. This timeout documents and bounds the admission point without exposing worker ids or queue internals.
Sourcepub fn max_total_child_rss_kib_limit(&self) -> Option<u64>
pub fn max_total_child_rss_kib_limit(&self) -> Option<u64>
Return the configured total child RSS budget in KiB.
Sourcepub fn per_worker_rss_ceiling_kib_limit(&self) -> Option<u64>
pub fn per_worker_rss_ceiling_kib_limit(&self) -> Option<u64>
Return the configured per-worker RSS ceiling in KiB.
Sourcepub fn idle_cycle_after_limit(&self) -> Option<Duration>
pub fn idle_cycle_after_limit(&self) -> Option<Duration>
Return the configured idle-cycle duration.
Sourcepub fn queue_wait_timeout_limit(&self) -> Duration
pub fn queue_wait_timeout_limit(&self) -> Duration
Return the configured pool admission wait timeout.
Trait Implementations§
Source§impl Clone for LeanWorkerPoolConfig
impl Clone for LeanWorkerPoolConfig
Source§fn clone(&self) -> LeanWorkerPoolConfig
fn clone(&self) -> LeanWorkerPoolConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more