pub struct SeekPoolSource<R: Read + Seek + Send> { /* private fields */ }Expand description
Wrap one or more legacy Read + Seek readers as an ImageSource. A
read_at checks out a free cursor from the pool (blocking on one if all are
busy), so parallel reads scale up to the pool size instead of serializing on
a single lock. A single-reader pool is a plain mutex. This is how a container
decoder (VHD/VMDK/QCOW2) hands its Read + Seek reader back as a DynSource.
Implementations§
Trait Implementations§
Source§impl<R: Read + Seek + Send> ImageSource for SeekPoolSource<R>
impl<R: Read + Seek + Send> ImageSource for SeekPoolSource<R>
Source§fn read_at(&self, offset: u64, buf: &mut [u8]) -> VfsResult<usize>
fn read_at(&self, offset: u64, buf: &mut [u8]) -> VfsResult<usize>
Fill
buf starting at byte offset. Returns bytes read (0 at/after EOF).
Never panics; a short read past EOF returns the available prefix length.Source§fn extents(&self) -> Extents
fn extents(&self) -> Extents
Allocated-extent map. Default = one dense extent covering
[0, len).Source§fn view(&self, offset: u64, len: usize) -> Option<SourceView<'_>>
fn view(&self, offset: u64, len: usize) -> Option<SourceView<'_>>
Optional zero-copy fast path.
None when the backing cannot lend a
contiguous view (the caller then uses ImageSource::read_at).Auto Trait Implementations§
impl<R> Freeze for SeekPoolSource<R>
impl<R> RefUnwindSafe for SeekPoolSource<R>
impl<R> Send for SeekPoolSource<R>
impl<R> Sync for SeekPoolSource<R>
impl<R> Unpin for SeekPoolSource<R>where
R: Unpin,
impl<R> UnsafeUnpin for SeekPoolSource<R>
impl<R> UnwindSafe for SeekPoolSource<R>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more