Skip to main content

PoolConfig

Struct PoolConfig 

Source
pub struct PoolConfig {
    pub min_processes: usize,
    pub max_processes: usize,
    pub transport: MontyTransport,
    pub checkout_timeout: Option<Duration>,
    pub request_timeout: Option<Duration>,
    pub feed_duration_limit_grace: Option<Duration>,
    pub turn_duration_limit_grace: Option<Duration>,
    pub max_checkouts_per_worker: Option<u32>,
    pub auto_resume: bool,
}
Expand description

Configuration for a Pool.

Fields§

§min_processes: usize

Workers spawned eagerly at pool creation and kept warm. Forced to 0 for the MontyTransport::Websocket transport (connections are made per-checkout, not pre-warmed).

§max_processes: usize

Hard cap on live workers; checkouts beyond this wait.

§transport: MontyTransport

How workers are reached (spawned locally or connected to remotely).

§checkout_timeout: Option<Duration>

How long Pool::checkout waits for a free worker before PoolError::Exhausted. None waits forever.

§request_timeout: Option<Duration>

Parent-side hard deadline per protocol turn: when it expires the worker is killed and the call fails with PoolError::Timeout. This backstops the child-side ResourceLimits — it also catches a child that hangs in ways the sandbox limits cannot see. Synchronous host telemetry callbacks prevent the timer from being polled while they run.

§feed_duration_limit_grace: Option<Duration>

Grace period for the automatic ResourceLimits::max_feed_duration backstop.

When a session has a feed budget, the worker reports the running feed’s execution time on every turn-ending event (the sandbox clock is the single source of truth: it runs only while the interpreter executes, never during suspensions waiting on the host or between feeds), and the parent bounds each turn by what that budget has left plus this grace.

The grace is the window in which the sandbox may raise TimeoutError itself and keep the session alive; a worker that misses it is killed and the call fails with PoolError::Timeout, so too short a grace costs workers that would have recovered.

§turn_duration_limit_grace: Option<Duration>

feed_duration_limit_grace for the ResourceLimits::max_turn_duration backstop: each turn is bounded by that whole limit plus this, the turn clock starting at zero.

§max_checkouts_per_worker: Option<u32>

Recycle (kill and respawn) a worker after this many checkouts, to bound the impact of any slow leak in a long-lived child.

§auto_resume: bool

Resume a session transparently when a relay that stores sessions answers a request with Shutdown: the checkout redials, reloads the state the shutdown named and re-sends the request the relay reported it did not run. The session’s suspension and sleep totals carry over. WebSocket transport only; on by default.

Implementations§

Source§

impl PoolConfig

Source

pub fn subprocess(binary_path: impl Into<PathBuf>) -> Self

Creates a subprocess-transport config with defaults: min_processes = 1, max_processes = available parallelism, no timeouts, a 1s grace on each of the two duration backstops, no recycling.

Source

pub fn websocket(url: impl Into<String>) -> Self

Creates a WebSocket-transport config dialing url verbatim per checkout. min_processes is 0 (no pre-warming — connections are made per-checkout).

Trait Implementations§

Source§

impl Clone for PoolConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PoolConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V