Skip to main content

ReconstructionPipeline

Struct ReconstructionPipeline 

Source
pub struct ReconstructionPipeline<const MAX_DELTAS: usize> { /* private fields */ }
Expand description

The reconstruction pipeline.

Orchestrates checkpoint decompression and delta application to reconstruct dormant memory regions.

MAX_DELTAS is the maximum number of witness deltas that can be buffered during a single reconstruction operation.

Implementations§

Source§

impl<const MAX_DELTAS: usize> ReconstructionPipeline<MAX_DELTAS>

Source

pub const fn new() -> Self

Create a new reconstruction pipeline.

Source

pub const fn delta_count(&self) -> usize

Return the number of buffered deltas.

Source

pub fn clear(&mut self)

Clear all buffered deltas.

Source

pub fn add_delta(&mut self, delta: WitnessDelta) -> RvmResult<()>

Add a witness delta to the reconstruction buffer.

Deltas must be added in sequence order.

§Errors

Returns RvmError::ResourceLimitExceeded if the buffer is full. Returns RvmError::WitnessChainBroken if the delta is out of sequence.

Source

pub fn reconstruct<F>( &self, checkpoint: &CompressedCheckpoint, compressed_data: &[u8], output: &mut [u8], delta_data_fn: F, ) -> RvmResult<ReconstructionResult>
where F: Fn(&WitnessDelta) -> &[u8],

Reconstruct a dormant region from a checkpoint and the buffered deltas.

§Parameters
  • checkpoint: Metadata about the compressed checkpoint.
  • compressed_data: The compressed checkpoint bytes.
  • output: Buffer to write the reconstructed region into. Must be at least checkpoint.uncompressed_size bytes.
  • delta_data_fn: A function that, given a WitnessDelta, returns a slice of the delta’s data bytes.
§Errors

Returns RvmError::CheckpointCorrupted if decompression fails, the hash does not match, or a delta is out of bounds. Returns RvmError::ResourceLimitExceeded if buffers are too small. Returns RvmError::WitnessVerificationFailed if a delta’s data hash does not match.

Trait Implementations§

Source§

impl<const MAX_DELTAS: usize> Default for ReconstructionPipeline<MAX_DELTAS>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<const MAX_DELTAS: usize> Freeze for ReconstructionPipeline<MAX_DELTAS>

§

impl<const MAX_DELTAS: usize> RefUnwindSafe for ReconstructionPipeline<MAX_DELTAS>

§

impl<const MAX_DELTAS: usize> Send for ReconstructionPipeline<MAX_DELTAS>

§

impl<const MAX_DELTAS: usize> Sync for ReconstructionPipeline<MAX_DELTAS>

§

impl<const MAX_DELTAS: usize> Unpin for ReconstructionPipeline<MAX_DELTAS>

§

impl<const MAX_DELTAS: usize> UnsafeUnpin for ReconstructionPipeline<MAX_DELTAS>

§

impl<const MAX_DELTAS: usize> UnwindSafe for ReconstructionPipeline<MAX_DELTAS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.