pub trait Policy {
    type ComputeNextUpdateTimePolicyData;
    type UpdateCheckAllowedPolicyData;
    type UpdateCanStartPolicyData;
    type RebootPolicyData;
    type InstallPlan: Plan;

    // Required methods
    fn compute_next_update_time(
        policy_data: &Self::ComputeNextUpdateTimePolicyData,
        apps: &[App],
        scheduling: &UpdateCheckSchedule,
        protocol_state: &ProtocolState
    ) -> CheckTiming;
    fn update_check_allowed(
        policy_data: &Self::UpdateCheckAllowedPolicyData,
        apps: &[App],
        scheduling: &UpdateCheckSchedule,
        protocol_state: &ProtocolState,
        check_options: &CheckOptions
    ) -> CheckDecision;
    fn update_can_start(
        policy_data: &Self::UpdateCanStartPolicyData,
        proposed_install_plan: &Self::InstallPlan
    ) -> UpdateDecision;
    fn reboot_allowed(
        policy_data: &Self::RebootPolicyData,
        check_options: &CheckOptions
    ) -> bool;
    fn reboot_needed(install_plan: &Self::InstallPlan) -> bool;
}
Expand description

The policy implementation itself

Required Associated Types§

Required Methods§

source

fn compute_next_update_time( policy_data: &Self::ComputeNextUpdateTimePolicyData, apps: &[App], scheduling: &UpdateCheckSchedule, protocol_state: &ProtocolState ) -> CheckTiming

When should the next update happen?

source

fn update_check_allowed( policy_data: &Self::UpdateCheckAllowedPolicyData, apps: &[App], scheduling: &UpdateCheckSchedule, protocol_state: &ProtocolState, check_options: &CheckOptions ) -> CheckDecision

Given the current State, and the current PolicyData, is an update check allowed at this time. A CheckDecision is used to return the reasoning, as in some cases, instead of an update check, the SM will instead notify Omaha that it would perform an update, but instead just tell the device whether or not an update is available.

source

fn update_can_start( policy_data: &Self::UpdateCanStartPolicyData, proposed_install_plan: &Self::InstallPlan ) -> UpdateDecision

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

source

fn reboot_allowed( policy_data: &Self::RebootPolicyData, check_options: &CheckOptions ) -> bool

Given the current PolicyData, is reboot allowed right now.

source

fn reboot_needed(install_plan: &Self::InstallPlan) -> bool

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

Object Safety§

This trait is not object safe.

Implementors§