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,
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§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,
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,
Sourcepub fn policy_engine<PE2: 'a + PolicyEngine>(
self,
policy_engine: PE2,
) -> StateMachineBuilder<PE2, HR, IN, TM, MR, ST, AS, CH>
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.
Sourcepub fn http<HR2: 'a + HttpRequest>(
self,
http: HR2,
) -> StateMachineBuilder<PE, HR2, IN, TM, MR, ST, AS, CH>
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.
Sourcepub fn installer<IN2: 'a + Installer>(
self,
installer: IN2,
) -> StateMachineBuilder<PE, HR, IN2, TM, MR, ST, AS, CH>
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.
Sourcepub fn timer<TM2: 'a + Timer>(
self,
timer: TM2,
) -> StateMachineBuilder<PE, HR, IN, TM2, MR, ST, AS, CH>
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.
Sourcepub fn metrics_reporter<MR2: 'a + MetricsReporter>(
self,
metrics_reporter: MR2,
) -> StateMachineBuilder<PE, HR, IN, TM, MR2, ST, AS, CH>
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.
Sourcepub fn storage<ST2: 'a + Storage>(
self,
storage: Rc<Mutex<ST2>>,
) -> StateMachineBuilder<PE, HR, IN, TM, MR, ST2, AS, CH>
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.
Sourcepub fn config(self, config: Config) -> Self
pub fn config(self, config: Config) -> Self
Configures the state machine to use the provided config.
Sourcepub fn app_set<AS2: 'a + AppSet>(
self,
app_set: Rc<Mutex<AS2>>,
) -> StateMachineBuilder<PE, HR, IN, TM, MR, ST, AS2, CH>
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.
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,
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,
pub async fn build(self) -> StateMachine<PE, HR, IN, TM, MR, ST, AS, CH>
Sourcepub async fn start(
self,
) -> (ControlHandle, impl Stream<Item = StateMachineEvent> + 'a)
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.
Sourcepub async fn oneshot_check(self) -> impl Stream<Item = StateMachineEvent> + 'a
pub async fn oneshot_check(self) -> impl Stream<Item = StateMachineEvent> + 'a
Run start_upate_check once, returning a stream of the states it produces.