omaha_client::policy

Trait PolicyEngine

Source
pub trait PolicyEngine {
    type TimeSource: TimeSource + Clone;
    type InstallResult;
    type InstallPlan: Plan;

    // Required methods
    fn time_source(&self) -> &Self::TimeSource;
    fn compute_next_update_time<'a>(
        &'a mut self,
        apps: &'a [App],
        scheduling: &'a UpdateCheckSchedule,
        protocol_state: &'a ProtocolState,
    ) -> BoxFuture<'a, CheckTiming>;
    fn update_check_allowed<'a>(
        &'a mut self,
        apps: &'a [App],
        scheduling: &'a UpdateCheckSchedule,
        protocol_state: &'a ProtocolState,
        check_options: &'a CheckOptions,
    ) -> BoxFuture<'a, CheckDecision>;
    fn update_can_start<'a>(
        &'a mut self,
        proposed_install_plan: &'a Self::InstallPlan,
    ) -> BoxFuture<'a, UpdateDecision>;
    fn reboot_allowed<'a>(
        &'a mut self,
        check_options: &'a CheckOptions,
        install_result: &'a Self::InstallResult,
    ) -> BoxFuture<'a, bool>;
    fn reboot_needed<'a>(
        &'a mut self,
        install_plan: &'a Self::InstallPlan,
    ) -> BoxFuture<'a, bool>;
}

Required Associated Types§

Required Methods§

Source

fn time_source(&self) -> &Self::TimeSource

Provides the time source used by the PolicyEngine to the state machine.

Source

fn compute_next_update_time<'a>( &'a mut self, apps: &'a [App], scheduling: &'a UpdateCheckSchedule, protocol_state: &'a ProtocolState, ) -> BoxFuture<'a, CheckTiming>

When should the next update happen?

Source

fn update_check_allowed<'a>( &'a mut self, apps: &'a [App], scheduling: &'a UpdateCheckSchedule, protocol_state: &'a ProtocolState, check_options: &'a CheckOptions, ) -> BoxFuture<'a, CheckDecision>

Given the context provided by State, does the Policy allow an update check to happen at this time? This should be consistent with the compute_next_update_time so that during background updates, the result of compute_next_update_time will result in a CheckDecision::Ok() value from this function.

Source

fn update_can_start<'a>( &'a mut self, proposed_install_plan: &'a Self::InstallPlan, ) -> BoxFuture<'a, UpdateDecision>

Given the current State, the current PolicyData, can the proposed InstallPlan be executed at this time.

Source

fn reboot_allowed<'a>( &'a mut self, check_options: &'a CheckOptions, install_result: &'a Self::InstallResult, ) -> BoxFuture<'a, bool>

Is reboot allowed right now.

Source

fn reboot_needed<'a>( &'a mut self, install_plan: &'a Self::InstallPlan, ) -> BoxFuture<'a, bool>

Given the InstallPlan, is reboot needed after update has been installed.

Implementors§