Skip to main content

PoolConfig

Struct PoolConfig 

Source
pub struct PoolConfig {
Show 14 fields pub name: Arc<str>, pub min_workers: u32, pub max_workers: u32, pub initial_workers: u32, pub autoscale: Option<AutoscaleConfig>, pub retry: RetryPolicy, pub bounds: Bounds, pub overflow: OverflowPolicy, pub reservable_fraction: f64, pub default_duration: Duration, pub max_hold: Duration, pub lease_ttl: Option<Duration>, pub unknown_dependency: UnknownDependency, pub fairness: Option<Fairness>,
}
Expand description

Engine types re-exported for convenience. A worker pool: capacity limits, scaling, retries, queue bounds and fixed-start behaviour.

Fields§

§name: Arc<str>

Unique pool name.

§min_workers: u32

Lower bound on the autoscaler’s desired capacity. Capacity itself may be lower, for example at start (initial_workers) or when it is reported by remote workers.

§max_workers: u32

Upper capacity bound for the autoscaler (also sizes the reservation limit).

§initial_workers: u32

Capacity at start (at most max_workers).

§autoscale: Option<AutoscaleConfig>

None disables autoscaling (capacity changes only via CapacityChanged).

§retry: RetryPolicy

Default retry policy for tasks without their own.

§bounds: Bounds

Pool queue bounds.

§overflow: OverflowPolicy

What to do when a bound is hit.

§reservable_fraction: f64

Fraction of max_workers that fixed-start reservations may occupy at once (at least 1 slot).

§default_duration: Duration

Duration estimate when nothing else is known.

§max_hold: Duration

Earliest a worker may be held free ahead of a fixed-start task.

§lease_ttl: Option<Duration>

Lease time-to-live; Some for remote workers that must heartbeat.

§unknown_dependency: UnknownDependency

Handling of dependencies on unknown keys.

§fairness: Option<Fairness>

Weighted fair sharing between tenants (None: tasks of a class run in submission order whatever their tenant).

Implementations§

Source§

impl PoolConfig

Source

pub fn new(name: impl Into<Arc<str>>) -> PoolConfig

Autoscaled pool with defaults: 1..=10 workers, starting at 1.

Source

pub fn fixed(name: impl Into<Arc<str>>, workers: u32) -> PoolConfig

Fixed worker count, no autoscaling.

Source

pub fn workers(self, min: u32, initial: u32, max: u32) -> PoolConfig

Set min, initial and max worker counts.

Trait Implementations§

Source§

impl Clone for PoolConfig

Source§

fn clone(&self) -> PoolConfig

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<(), Error>

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<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> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more