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§
type ComputeNextUpdateTimePolicyData
type UpdateCheckAllowedPolicyData
type UpdateCanStartPolicyData
type RebootPolicyData
type InstallPlan: Plan
Required Methods§
Sourcefn compute_next_update_time(
policy_data: &Self::ComputeNextUpdateTimePolicyData,
apps: &[App],
scheduling: &UpdateCheckSchedule,
protocol_state: &ProtocolState,
) -> CheckTiming
fn compute_next_update_time( policy_data: &Self::ComputeNextUpdateTimePolicyData, apps: &[App], scheduling: &UpdateCheckSchedule, protocol_state: &ProtocolState, ) -> CheckTiming
When should the next update happen?
Sourcefn update_check_allowed(
policy_data: &Self::UpdateCheckAllowedPolicyData,
apps: &[App],
scheduling: &UpdateCheckSchedule,
protocol_state: &ProtocolState,
check_options: &CheckOptions,
) -> CheckDecision
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.
Sourcefn update_can_start(
policy_data: &Self::UpdateCanStartPolicyData,
proposed_install_plan: &Self::InstallPlan,
) -> UpdateDecision
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.
Sourcefn reboot_allowed(
policy_data: &Self::RebootPolicyData,
check_options: &CheckOptions,
) -> bool
fn reboot_allowed( policy_data: &Self::RebootPolicyData, check_options: &CheckOptions, ) -> bool
Given the current PolicyData, is reboot allowed right now.
Sourcefn reboot_needed(install_plan: &Self::InstallPlan) -> bool
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.