Struct Checkpoint
pub struct Checkpoint {
pub header: CheckpointHeader,
pub metadata: CheckpointMetadata,
pub chunks: Vec<DataChunk>,
}Expand description
Complete checkpoint containing all kernel state.
Fields§
§header: CheckpointHeaderCheckpoint header.
metadata: CheckpointMetadataKernel metadata.
chunks: Vec<DataChunk>Data chunks.
Implementations§
§impl Checkpoint
impl Checkpoint
pub fn new(metadata: CheckpointMetadata) -> Checkpoint
pub fn new(metadata: CheckpointMetadata) -> Checkpoint
Create a new checkpoint.
pub fn add_control_block(&mut self, data: Vec<u8>)
pub fn add_control_block(&mut self, data: Vec<u8>)
Add control block data.
pub fn add_h2k_queue(&mut self, data: Vec<u8>)
pub fn add_h2k_queue(&mut self, data: Vec<u8>)
Add H2K queue data.
pub fn add_k2h_queue(&mut self, data: Vec<u8>)
pub fn add_k2h_queue(&mut self, data: Vec<u8>)
Add K2H queue data.
pub fn add_hlc_state(&mut self, data: Vec<u8>)
pub fn add_hlc_state(&mut self, data: Vec<u8>)
Add HLC state.
pub fn add_device_memory(&mut self, name: &str, data: Vec<u8>)
pub fn add_device_memory(&mut self, name: &str, data: Vec<u8>)
Add device memory region.
pub fn get_chunks(&self, chunk_type: ChunkType) -> Vec<&DataChunk>
pub fn get_chunks(&self, chunk_type: ChunkType) -> Vec<&DataChunk>
Get all chunks of a type.
pub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Calculate total size in bytes.
pub fn from_bytes(bytes: &[u8]) -> Result<Checkpoint, RingKernelError>
pub fn from_bytes(bytes: &[u8]) -> Result<Checkpoint, RingKernelError>
Deserialize checkpoint from bytes.
§impl Checkpoint
impl Checkpoint
pub fn content_digest(&self) -> String
pub fn content_digest(&self) -> String
Stable content digest of the checkpoint’s data chunks.
This is a CRC32 over each chunk’s (identity, data) in the order
they were added. Two checkpoints with the same content digest
have identical chunk contents at identical identities. Used as
the stable “parent id” for delta checkpoints.
pub fn delta_from(base: &Checkpoint, new: &Checkpoint) -> Checkpoint
pub fn delta_from(base: &Checkpoint, new: &Checkpoint) -> Checkpoint
Produce a delta checkpoint: chunks present in new whose bytes
differ from the corresponding chunk in base (same identity),
plus chunks that are new in new. Unchanged chunks are omitted.
The delta’s metadata.custom records the base’s content digest
under DELTA_PARENT_DIGEST_KEY so the reader can verify it
before applying.
Restore via Checkpoint::applied_with_delta.
pub fn applied_with_delta(
base: &Checkpoint,
delta: &Checkpoint,
) -> Result<Checkpoint, RingKernelError>
pub fn applied_with_delta( base: &Checkpoint, delta: &Checkpoint, ) -> Result<Checkpoint, RingKernelError>
Apply a delta produced by Checkpoint::delta_from on top of
base, returning the resulting full checkpoint. Chunks in the
delta replace chunks with the same identity in base; chunks
only in base carry over unchanged.
Errors if the delta’s recorded parent digest does not match
base.content_digest() — this catches accidental application
on top of the wrong base.
Trait Implementations§
§impl Clone for Checkpoint
impl Clone for Checkpoint
§fn clone(&self) -> Checkpoint
fn clone(&self) -> Checkpoint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for Checkpoint
impl RefUnwindSafe for Checkpoint
impl Send for Checkpoint
impl Sync for Checkpoint
impl Unpin for Checkpoint
impl UnwindSafe for Checkpoint
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<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>
§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>
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