pub struct PrefetchedSectorSource { /* private fields */ }Expand description
Producer-thread-backed SectorSource decorator. Construct it
with the real reader, the extent list to walk, and the batch
size; the wrapper spawns the producer immediately and starts
filling the channel.
Implementations§
Source§impl PrefetchedSectorSource
impl PrefetchedSectorSource
Sourcepub fn new<S>(
reader: S,
extents: Vec<Extent>,
batch_sectors: u16,
halt: Option<Halt>,
) -> Result<Self>where
S: SectorSource + Send + 'static,
pub fn new<S>(
reader: S,
extents: Vec<Extent>,
batch_sectors: u16,
halt: Option<Halt>,
) -> Result<Self>where
S: SectorSource + Send + 'static,
Spawn the producer thread. reader must already be the fully
composed read+decrypt stack (e.g.
DecryptingSectorSource)
— every byte the producer emits is what the consumer’s demux
will feed to its codec parsers.
§Unit-alignment precondition
Each extent’s sector_count should be a multiple of
[SECTOR_ALIGNMENT] (3 sectors / one 6144-byte AACS aligned
unit). Blu-ray m2ts extents satisfy this by spec. If an extent
has a trailing 1-2 sectors that cannot fill a complete unit,
the producer surfaces Error::ExtentNotUnitAligned through
the channel rather than handing the decrypt step a sub-unit
chunk it would silently leave encrypted.
Sourcepub fn new_with_events<S>(
reader: S,
extents: Vec<Extent>,
batch_sectors: u16,
halt: Option<Halt>,
event_fn: Option<EventFn>,
) -> Result<Self>where
S: SectorSource + Send + 'static,
pub fn new_with_events<S>(
reader: S,
extents: Vec<Extent>,
batch_sectors: u16,
halt: Option<Halt>,
event_fn: Option<EventFn>,
) -> Result<Self>where
S: SectorSource + Send + 'static,
Same as [new] but with a callback fired from the producer
thread after each successful batch — used by autorip’s mux
path to surface BytesRead progress to the UI without the
consumer thread having to poll.
Sourcepub fn into_channels(self) -> (Receiver<Batch>, Sender<Vec<u8>>, PrefetchShell)
pub fn into_channels(self) -> (Receiver<Batch>, Sender<Vec<u8>>, PrefetchShell)
Peel off the receivers for zero-copy pipeline mode. The
caller (typically [super::super::mux::demux_thread::DemuxThread])
pulls buffers from rx, consumes them, and pushes the empty
Vec<u8> back through recycle_tx so the producer can
re-fill it. The producer-thread JoinHandle stays with the
returned PrefetchedSectorSource shell; drop that to join.
Returns (forward_rx, recycle_tx, shell). The shell only
holds the join handle and total_sectors for capacity_sectors
queries; its SectorSource impl becomes invalid after this
call (data has been moved out).
Trait Implementations§
Source§impl Drop for PrefetchedSectorSource
impl Drop for PrefetchedSectorSource
Source§impl SectorSource for PrefetchedSectorSource
impl SectorSource for PrefetchedSectorSource
Source§fn capacity_sectors(&self) -> u32
fn capacity_sectors(&self) -> u32
0 = unknown
(e.g. live drives that haven’t completed READ CAPACITY yet).Source§fn read_sectors(
&mut self,
_lba: u32,
_count: u16,
buf: &mut [u8],
_recovery: bool,
) -> Result<usize>
fn read_sectors( &mut self, _lba: u32, _count: u16, buf: &mut [u8], _recovery: bool, ) -> Result<usize>
count sectors starting at lba into buf.
buf must be at least count * 2048 bytes.
recovery: true = full retry/reset loop (ripping),
false = single attempt (verify). File-backed sources ignore
the flag. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PrefetchedSectorSource
impl !UnwindSafe for PrefetchedSectorSource
impl Freeze for PrefetchedSectorSource
impl Send for PrefetchedSectorSource
impl Sync for PrefetchedSectorSource
impl Unpin for PrefetchedSectorSource
impl UnsafeUnpin for PrefetchedSectorSource
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more