Struct RecoveryManager
pub struct RecoveryManager {
config: RwLock<RawRwLock, RecoveryConfig>,
handlers: RwLock<RawRwLock, HashMap<RecoveryPolicy, Arc<dyn Fn(&RecoveryAction) -> Pin<Box<dyn Future<Output = RecoveryResult> + Send>> + Send + Sync>>>,
history: RwLock<RawRwLock, HashMap<KernelId, Vec<RecoveryResult>>>,
attempts: RwLock<RawRwLock, HashMap<KernelId, u32>>,
last_recovery: RwLock<RawRwLock, HashMap<KernelId, Instant>>,
stats: RecoveryStats,
enabled: AtomicBool,
}Expand description
Manager for automatic kernel recovery.
Fields§
§config: RwLock<RawRwLock, RecoveryConfig>§handlers: RwLock<RawRwLock, HashMap<RecoveryPolicy, Arc<dyn Fn(&RecoveryAction) -> Pin<Box<dyn Future<Output = RecoveryResult> + Send>> + Send + Sync>>>§history: RwLock<RawRwLock, HashMap<KernelId, Vec<RecoveryResult>>>§attempts: RwLock<RawRwLock, HashMap<KernelId, u32>>§last_recovery: RwLock<RawRwLock, HashMap<KernelId, Instant>>§stats: RecoveryStats§enabled: AtomicBoolImplementations§
§impl RecoveryManager
impl RecoveryManager
pub fn new() -> RecoveryManager
pub fn new() -> RecoveryManager
Create a new recovery manager with default config.
pub fn with_config(config: RecoveryConfig) -> RecoveryManager
pub fn with_config(config: RecoveryConfig) -> RecoveryManager
Create with specific configuration.
pub fn set_enabled(&self, enabled: bool)
pub fn set_enabled(&self, enabled: bool)
Enable/disable automatic recovery.
pub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if recovery is enabled.
pub fn set_config(&self, config: RecoveryConfig)
pub fn set_config(&self, config: RecoveryConfig)
Update configuration.
pub fn config(&self) -> RecoveryConfig
pub fn config(&self) -> RecoveryConfig
Get current configuration.
pub fn register_handler(
&self,
policy: RecoveryPolicy,
handler: Arc<dyn Fn(&RecoveryAction) -> Pin<Box<dyn Future<Output = RecoveryResult> + Send>> + Send + Sync>,
)
pub fn register_handler( &self, policy: RecoveryPolicy, handler: Arc<dyn Fn(&RecoveryAction) -> Pin<Box<dyn Future<Output = RecoveryResult> + Send>> + Send + Sync>, )
Register a recovery handler.
pub fn should_recover(&self, kernel_id: &KernelId) -> bool
pub fn should_recover(&self, kernel_id: &KernelId) -> bool
Check if recovery should be attempted (respects cooldown).
pub fn determine_action(
&self,
kernel_id: &KernelId,
failure_type: FailureType,
) -> RecoveryAction
pub fn determine_action( &self, kernel_id: &KernelId, failure_type: FailureType, ) -> RecoveryAction
Determine recovery action for a failure.
pub async fn recover(&self, action: RecoveryAction) -> RecoveryResult
pub async fn recover(&self, action: RecoveryAction) -> RecoveryResult
Execute recovery for a kernel.
pub fn get_history(&self, kernel_id: &KernelId) -> Vec<RecoveryResult>
pub fn get_history(&self, kernel_id: &KernelId) -> Vec<RecoveryResult>
Get recovery history for a kernel.
pub fn clear_history(&self)
pub fn clear_history(&self)
Clear recovery history.
pub fn stats(&self) -> RecoveryStatsSnapshot
pub fn stats(&self) -> RecoveryStatsSnapshot
Get statistics snapshot.
Trait Implementations§
§impl Default for RecoveryManager
impl Default for RecoveryManager
§fn default() -> RecoveryManager
fn default() -> RecoveryManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for RecoveryManager
impl !RefUnwindSafe for RecoveryManager
impl Send for RecoveryManager
impl Sync for RecoveryManager
impl Unpin for RecoveryManager
impl !UnwindSafe for RecoveryManager
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.