omaha_client::policy

Trait Policy

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§