pub struct RestartStrategyModel { /* private fields */ }Expand description
Learned restart strategy replacing fixed backoff delays and retry decisions.
Inputs (4): failure_count, failure_type_ordinal, uptime_before_failure_secs, system_load (0.0-1.0) Outputs (2): optimal_delay_ms, should_retry (>0.5 = yes)
Fallback: exponential backoff 100ms * 2^(n-1), capped at 30s; always retry.
Implementations§
Source§impl RestartStrategyModel
impl RestartStrategyModel
Sourcepub fn drain_events(&mut self) -> Vec<EmlEvent>
pub fn drain_events(&mut self) -> Vec<EmlEvent>
Drain accumulated EML lifecycle events for ExoChain forwarding.
Sourcepub fn is_trained(&self) -> bool
pub fn is_trained(&self) -> bool
Whether the model has been trained.
Sourcepub fn training_sample_count(&self) -> usize
pub fn training_sample_count(&self) -> usize
Number of training samples collected.
Sourcepub fn predict(
&self,
failure_count: u32,
failure_type: u32,
uptime_before_failure_secs: f64,
system_load: f64,
) -> (u64, bool)
pub fn predict( &self, failure_count: u32, failure_type: u32, uptime_before_failure_secs: f64, system_load: f64, ) -> (u64, bool)
Predict restart parameters.
Returns (delay_ms, should_retry) where should_retry is true
when the model’s second head exceeds 0.5.
When untrained, uses exponential backoff: 100 * 2^(failure_count-1), capped at 30_000ms, and always retries.
Sourcepub fn record(
&mut self,
failure_count: u32,
failure_type: u32,
uptime_before_failure_secs: f64,
system_load: f64,
actual_delay_ms: u64,
recovery_succeeded: bool,
)
pub fn record( &mut self, failure_count: u32, failure_type: u32, uptime_before_failure_secs: f64, system_load: f64, actual_delay_ms: u64, recovery_succeeded: bool, )
Record a restart outcome for training.
actual_delay_ms is the delay that led to successful recovery.
recovery_succeeded indicates whether the restart succeeded.
Trait Implementations§
Source§impl Clone for RestartStrategyModel
impl Clone for RestartStrategyModel
Source§impl Debug for RestartStrategyModel
impl Debug for RestartStrategyModel
Source§impl Default for RestartStrategyModel
impl Default for RestartStrategyModel
Source§impl<'de> Deserialize<'de> for RestartStrategyModel
impl<'de> Deserialize<'de> for RestartStrategyModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RestartStrategyModel
impl RefUnwindSafe for RestartStrategyModel
impl Send for RestartStrategyModel
impl Sync for RestartStrategyModel
impl Unpin for RestartStrategyModel
impl UnsafeUnpin for RestartStrategyModel
impl UnwindSafe for RestartStrategyModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more