Skip to main content

SnapshotSink

Trait SnapshotSink 

Source
pub trait SnapshotSink {
    // Required methods
    fn write(&mut self, bytes: &[u8]) -> Result<(), Error>;
    fn patch(&mut self, at: u64, bytes: &[u8]) -> Result<(), Error>;
}
Expand description

A byte sink for streaming a snapshot without materializing the whole image: write appends in file order, patch overwrites a short run at an absolute offset — used once for the header file-hash field, the only non-sequential write, done after the body has streamed.

Required Methods§

Source

fn write(&mut self, bytes: &[u8]) -> Result<(), Error>

Appends bytes at the current position.

§Errors

Whatever the underlying sink reports (e.g. an I/O error).

Source

fn patch(&mut self, at: u64, bytes: &[u8]) -> Result<(), Error>

Overwrites bytes at absolute offset at (already-written region).

§Errors

Whatever the underlying sink reports.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SnapshotSink for &mut Vec<u8>

Source§

fn write(&mut self, bytes: &[u8]) -> Result<(), Error>

Source§

fn patch(&mut self, at: u64, bytes: &[u8]) -> Result<(), Error>

Implementors§