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§
Sourcefn time_source(&self) -> &Self::TimeSource
fn time_source(&self) -> &Self::TimeSource
Provides the time source used by the PolicyEngine to the state machine.
Sourcefn compute_next_update_time<'a>(
&'a mut self,
apps: &'a [App],
scheduling: &'a UpdateCheckSchedule,
protocol_state: &'a ProtocolState,
) -> BoxFuture<'a, CheckTiming>
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?
Sourcefn 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_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.
Sourcefn update_can_start<'a>(
&'a mut self,
proposed_install_plan: &'a Self::InstallPlan,
) -> BoxFuture<'a, UpdateDecision>
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.
Sourcefn reboot_allowed<'a>(
&'a mut self,
check_options: &'a CheckOptions,
install_result: &'a Self::InstallResult,
) -> BoxFuture<'a, bool>
fn reboot_allowed<'a>( &'a mut self, check_options: &'a CheckOptions, install_result: &'a Self::InstallResult, ) -> BoxFuture<'a, bool>
Is reboot allowed right now.
Sourcefn reboot_needed<'a>(
&'a mut self,
install_plan: &'a Self::InstallPlan,
) -> BoxFuture<'a, bool>
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.