pub struct StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>
where PE: PolicyEngine, HR: HttpRequest, IN: Installer, TM: Timer, MR: MetricsReporter, ST: Storage, AS: AppSet, CH: Cupv2Handler,
{ /* private fields */ }
Expand description

Helper type to build/start a StateMachine.

Implementations§

source§

impl<'a, PE, HR, IN, TM, MR, ST, AS, CH> StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>
where PE: 'a + PolicyEngine, HR: 'a + HttpRequest, IN: 'a + Installer, TM: 'a + Timer, MR: 'a + MetricsReporter, ST: 'a + Storage, AS: 'a + AppSet, CH: 'a + Cupv2Handler,

source

pub fn new( policy_engine: PE, http: HR, installer: IN, timer: TM, metrics_reporter: MR, storage: Rc<Mutex<ST>>, config: Config, app_set: Rc<Mutex<AS>>, cup_handler: Option<CH> ) -> Self

Creates a new StateMachineBuilder using the given trait implementations.

source§

impl<'a, PE, HR, IN, TM, MR, ST, AS, CH> StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>
where PE: 'a + PolicyEngine, HR: 'a + HttpRequest, IN: 'a + Installer, TM: 'a + Timer, MR: 'a + MetricsReporter, ST: 'a + Storage, AS: 'a + AppSet, CH: 'a + Cupv2Handler,

source

pub fn policy_engine<PE2: 'a + PolicyEngine>( self, policy_engine: PE2 ) -> StateMachineBuilder<PE2, HR, IN, TM, MR, ST, AS, CH>

Configures the state machine to use the provided policy_engine implementation.

source

pub fn http<HR2: 'a + HttpRequest>( self, http: HR2 ) -> StateMachineBuilder<PE, HR2, IN, TM, MR, ST, AS, CH>

Configures the state machine to use the provided http implementation.

source

pub fn installer<IN2: 'a + Installer>( self, installer: IN2 ) -> StateMachineBuilder<PE, HR, IN2, TM, MR, ST, AS, CH>

Configures the state machine to use the provided installer implementation.

source

pub fn timer<TM2: 'a + Timer>( self, timer: TM2 ) -> StateMachineBuilder<PE, HR, IN, TM2, MR, ST, AS, CH>

Configures the state machine to use the provided timer implementation.

source

pub fn metrics_reporter<MR2: 'a + MetricsReporter>( self, metrics_reporter: MR2 ) -> StateMachineBuilder<PE, HR, IN, TM, MR2, ST, AS, CH>

Configures the state machine to use the provided metrics_reporter implementation.

source

pub fn storage<ST2: 'a + Storage>( self, storage: Rc<Mutex<ST2>> ) -> StateMachineBuilder<PE, HR, IN, TM, MR, ST2, AS, CH>

Configures the state machine to use the provided storage implementation.

source

pub fn config(self, config: Config) -> Self

Configures the state machine to use the provided config.

source

pub fn app_set<AS2: 'a + AppSet>( self, app_set: Rc<Mutex<AS2>> ) -> StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS2, CH>

Configures the state machine to use the provided app_set implementation.

source

pub fn cup_handler<CH2: 'a + Cupv2Handler>( self, cup_handler: Option<CH2> ) -> StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH2>

source§

impl<'a, PE, HR, IN, TM, MR, ST, AS, CH, IR, PL> StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>
where PE: 'a + PolicyEngine<InstallResult = IR, InstallPlan = PL>, HR: 'a + HttpRequest, IN: 'a + Installer<InstallResult = IR, InstallPlan = PL>, TM: 'a + Timer, MR: 'a + MetricsReporter, ST: 'a + Storage, AS: 'a + AppSet, CH: 'a + Cupv2Handler, IR: 'static + Send, PL: 'a + Plan,

source

pub async fn build(self) -> StateMachine<PE, HR, IN, TM, MR, ST, AS, CH>

source

pub async fn start( self ) -> (ControlHandle, impl Stream<Item = StateMachineEvent> + 'a)

Start the StateMachine to do periodic update checks in the background or when requested through the returned control handle. The returned stream must be polled to make forward progress.

source

pub async fn oneshot_check(self) -> impl Stream<Item = StateMachineEvent> + 'a

Run start_upate_check once, returning a stream of the states it produces.

Trait Implementations§

source§

impl<PE, HR, IN, TM, MR, ST, AS, CH> Debug for StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<PE, HR, IN, TM, MR, ST, AS, CH> !RefUnwindSafe for StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>

§

impl<PE, HR, IN, TM, MR, ST, AS, CH> !Send for StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>

§

impl<PE, HR, IN, TM, MR, ST, AS, CH> !Sync for StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>

§

impl<PE, HR, IN, TM, MR, ST, AS, CH> Unpin for StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>
where CH: Unpin, HR: Unpin, IN: Unpin, MR: Unpin, PE: Unpin, TM: Unpin,

§

impl<PE, HR, IN, TM, MR, ST, AS, CH> !UnwindSafe for StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>

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.

§

impl<T> Instrument for T

§

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

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

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

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

source§

fn unless(self, option: Option<T>) -> T

§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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