Skip to main content

Reconciler

Struct Reconciler 

Source
pub struct Reconciler { /* private fields */ }
Expand description

The reconciliation loop.

One per target, as f3 runs them; they share a RunnerLauncher and an AllocationLock, which is what keeps the host ceiling true across all of them.

Implementations§

Source§

impl Reconciler

Source

pub fn new(host: Host, ports: ReconcilerPorts) -> Self

Build a reconciler polling at the host’s configured interval.

Source

pub const fn host(&self) -> &Host

Source

pub const fn schedule(&self) -> &PollSchedule

Source

pub const fn repositories(&self) -> &RepositoryCache

The repository-list cache, so f1 can report what it has spent.

Source

pub async fn reconcile(&mut self, policies: &[ScalePolicy]) -> ReconcileReport

One reconciliation pass over policies.

The order of operations is 03-control-flows.md flow 2, and the two steps most worth naming are the ones that are silent when they are wrong:

  • Monitor-only policies are removed before the demand poll, not after. D19 says such a policy “is skipped entirely by reconciliation”, and a poll issued on its behalf would spend requests from the shared ceiling for a policy that can never act on the answer. This is asserted on ScalePolicy::owns_runners rather than deduced from max_capacity being absent.
  • The attempt set is re-read under the lock, once per runtime. See RunnerLauncher for why it comes from there and nowhere else.
Source

pub async fn scale_down(&self, policy: &ScalePolicy) -> ScaleDownReport

Reclaim what can be reclaimed for one policy, and nothing else.

A busy attempt is never removed. 04-subsystem-contracts.md: busy cannot transition to cleanup due to a scale-down request”. Capacity comes back when an attempt reaches a terminal state and at no other time, so a scale-down against a host full of busy runners removes nothing, changes nothing, and says so.

Trait Implementations§

Source§

impl Debug for Reconciler

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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