Skip to main content

spawn_fetch_segment

Function spawn_fetch_segment 

Source
fn spawn_fetch_segment(
    io: Arc<dyn WalObjectIo>,
    object_seq: u64,
    entry: FooterEntry,
    permit: Option<OwnedSemaphorePermit>,
) -> impl Future<Output = (Result<Vec<Record>>, Option<OwnedSemaphorePermit>)> + Send + 'static
Expand description

Runs fetch_segment on a task of its own, so the fetch proceeds while the read is busy with earlier segments, and returns the outcome with permit. The task holds the permit, so the reserved bytes are released only with the buffers of the fetch. Dropping the returned future, as a dropped read does, aborts the task; a task that panics fails the fetch with Error::WalSegmentFetch.