Skip to main content

PoolCensus

Struct PoolCensus 

Source
pub struct PoolCensus {
    pub workers_in_pool: usize,
    pub workers_serving_activity: usize,
    pub compatible_workers: usize,
    pub eligible_compatible_workers: usize,
    pub compatible_workers_reachability_lost: usize,
    pub compatible_workers_at_capacity: usize,
    pub compatible_workers_capacity_unannounced: usize,
    pub last_compatible_poller_age: Option<Duration>,
}
Expand description

What the connected-worker registry holds for one (namespace, task_queue, activity_type[, node]) address.

Fields§

§workers_in_pool: usize

Workers connected for (namespace, task_queue), whatever they serve.

§workers_serving_activity: usize

Of those, workers advertising this activity type.

§compatible_workers: usize

Of those, workers that also satisfy the dispatch’s node pin. Equal to Self::workers_serving_activity for an unpinned dispatch.

Deliberately NOT filtered by dispatch eligibility, so classify can tell an empty pool from an excluded one (#197 R3).

§eligible_compatible_workers: usize

Of Self::compatible_workers, those a dispatch could actually be handed to right now — the rest are excluded by the liveness verdict.

§compatible_workers_reachability_lost: usize

Of the excluded compatible workers, those excluded by DispatchExclusion::ReachabilityLost rather than by an opening probation.

🔴 The whole point of the distinction. An opening probation clears itself in seconds, so parking silently through one is correct and announcing it would be noise on every healthy connect. A lost reachability does NOT clear on its own, so a dispatch parked on one waits indefinitely — and must say so, or it is a silent stall.

§compatible_workers_at_capacity: usize

Of Self::compatible_workers, those already holding every dispatch they advertised they would run at once.

🔴 A THIRD condition, and the reason classify needs a third answer. An at-capacity pool is neither empty nor unreachable: its workers are connected, serving this activity, and working. The remedy is the OPPOSITE of the unreachable one — starting another worker helps here and does not help there — so reporting either existing reason for it would send an operator the wrong way.

§compatible_workers_capacity_unannounced: usize

Of Self::compatible_workers, those that have registered but have not yet announced how much work they can take.

🔴 DISJOINT from Self::compatible_workers_at_capacity, and counted apart from it on purpose. Selection excludes both, by the same test — unknown capacity is treated as full — so a census that folded them together would be arithmetically fine and operationally a lie: it would report a pool of idle, mute workers as a pool of busy ones, and attach the advice for a busy pool (“start another worker”) to a condition another worker of the same build cannot fix.

Only the liminal transport can produce it, and normally only for the one round trip between a worker’s registration and its capacity announcement.

§last_compatible_poller_age: Option<Duration>

How long ago a compatible worker was last in service, or None when none has ever been seen for this address in this server’s life.

Zero while a compatible worker is connected right now.

Implementations§

Source§

impl PoolCensus

Source

pub const fn is_served(&self) -> bool

Whether the address currently has a compatible worker REGISTERED, whatever its dispatch eligibility.

A field-level fact, not a decision. It stays deliberately blind to eligibility because classify needs the blind count to tell an empty pool from an excluded one (#197 R3). Callers asking “will a dispatch aimed here actually proceed?” want Self::will_be_served.

Source

pub const fn will_be_served(&self) -> bool

Whether a dispatch aimed here can be expected to proceed without an operator doing something first.

🔴 The distinction Self::is_served cannot draw. A pool whose workers are all serving an opening probation is not dispatchable this instant but will be within seconds, so it answers true — waiting is the correct outcome and the caller should not be warned. A pool whose workers have all LOST reachability answers false: nothing about it improves on its own, so a caller told “served” would be told a run is about to proceed when it is about to park indefinitely.

A pool whose workers are all AT CAPACITY answers true for the same reason as the probation case: it is not dispatchable this instant and needs nobody to do anything — a running activity finishes, a slot frees, and the parked dispatch is selected. Waiting is the correct outcome.

A pool whose workers have NOT ANNOUNCED their capacity answers false, and is the reason this is no longer two clauses. Nothing about that pool improves on its own: the announcement either already arrived — in which case these workers are not in this bucket — or it never will, because the worker is a build that does not send one or its publish was lost. Saying “will be served” of a fleet that is registered, idle, mute and permanently unselectable is the most expensive kind of wrong answer, because the whole point of this predicate is to tell a caller whether waiting is enough.

Trait Implementations§

Source§

impl Clone for PoolCensus

Source§

fn clone(&self) -> PoolCensus

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 Copy for PoolCensus

Source§

impl Debug for PoolCensus

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PoolCensus

Source§

fn default() -> PoolCensus

Returns the “default value” for a type. Read more
Source§

impl Eq for PoolCensus

Source§

impl PartialEq for PoolCensus

Source§

fn eq(&self, other: &PoolCensus) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PoolCensus

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> AsOut<T> for T
where T: Copy,

Source§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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

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