pub trait CheckpointableKernel: GpuKernel {
type Checkpoint: Serialize + DeserializeOwned + Send + Sync;
// Required methods
fn checkpoint<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Checkpoint>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn restore<'life0, 'async_trait>(
&'life0 mut self,
checkpoint: Self::Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn can_checkpoint(&self) -> bool { ... }
fn checkpoint_size_estimate(&self) -> usize { ... }
}Expand description
Trait for kernels that support checkpoint/restore.
Enables recovery from failures by saving and restoring kernel state. Useful for long-running or stateful kernels.
§Type Parameters
C: Checkpoint type (must be serializable)
Required Associated Types§
Sourcetype Checkpoint: Serialize + DeserializeOwned + Send + Sync
type Checkpoint: Serialize + DeserializeOwned + Send + Sync
The checkpoint state type
Required Methods§
Sourcefn checkpoint<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Checkpoint>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn checkpoint<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Checkpoint>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a checkpoint of current kernel state.
§Returns
A serializable checkpoint that can be used to restore state.
Provided Methods§
Sourcefn can_checkpoint(&self) -> bool
fn can_checkpoint(&self) -> bool
Check if checkpointing is currently safe.
Returns false if the kernel is in the middle of an operation that cannot be interrupted.
Sourcefn checkpoint_size_estimate(&self) -> usize
fn checkpoint_size_estimate(&self) -> usize
Get the size of the checkpoint in bytes (estimate).
Useful for monitoring and capacity planning.