Skip to main content

Snapshot

Struct Snapshot 

Source
pub struct Snapshot<'v, R> { /* private fields */ }
Expand description

A reconstructed, read-only view of one shadow copy — the snapshot’s view of the volume, materialized block by block on demand.

Built by VssVolume::snapshot; borrows the volume’s reader mutably so reconstruction can pull live and store blocks lazily (the volumes are far too large to hold in memory).

Implementations§

Source§

impl<R: Read + Seek> Snapshot<'_, R>

Source

pub fn read_block(&mut self, offset: u64) -> Result<[u8; 16384], VssError>

Reconstruct the single aligned 16384-byte block containing offset.

offset need not be block-aligned; the block it falls in is reconstructed in full. A block at or past the end of the volume reconstructs as zeros.

§Errors

VssError::Io on an underlying read/seek failure.

Source

pub fn read_at(&mut self, offset: u64, buf: &mut [u8]) -> Result<(), VssError>

Reconstruct an arbitrary-length, arbitrary-offset read, materializing each spanned block and copying the requested slice out.

Bytes at or past the end of the volume read as zeros.

§Errors

VssError::Io on an underlying read/seek failure.

Auto Trait Implementations§

§

impl<'v, R> !UnwindSafe for Snapshot<'v, R>

§

impl<'v, R> Freeze for Snapshot<'v, R>

§

impl<'v, R> RefUnwindSafe for Snapshot<'v, R>
where R: RefUnwindSafe,

§

impl<'v, R> Send for Snapshot<'v, R>
where R: Send,

§

impl<'v, R> Sync for Snapshot<'v, R>
where R: Sync,

§

impl<'v, R> Unpin for Snapshot<'v, R>

§

impl<'v, R> UnsafeUnpin for Snapshot<'v, R>

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.