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>
impl<R: Read + Seek> Snapshot<'_, R>
Sourcepub fn read_block(&mut self, offset: u64) -> Result<[u8; 16384], VssError>
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.
Sourcepub fn read_at(&mut self, offset: u64, buf: &mut [u8]) -> Result<(), VssError>
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.