omaha_client::state_machine

Struct StateMachineBuilder

Source
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> Freeze for StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS, CH>
where PE: Freeze, HR: Freeze, IN: Freeze, TM: Freeze, MR: Freeze, CH: Freeze,

§

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 PE: Unpin, HR: Unpin, IN: Unpin, TM: Unpin, MR: Unpin, CH: 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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

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> 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