Skip to content
API REFERENCEUsage guides →

cellpack::store::RecordReadPlan ​

struct

Module contract · All interfaces

At a glance ​

pub struct RecordReadPlan { /* private fields */ }

Reads for a list of cells and the buffer slice each cell’s record occupies.

Built from metadata alone, so it is reusable for every read of the same cells; the ranges are relative to the records region, not to file offsets.

Member index ​

5 of 5 members

  • newPlans reads for cells (indices within one chunk’s metadata) under o .
  • rangesThe reads to issue, in buffer order.
  • summaryWhat this plan reads, for cost accounting and tests.
  • recordThe position -th requested cell’s record, sliced from a buffer RecordReadPlan::read_into filled; empty records give an empty slice. A position past the plan, or a buffer that does not cover the record’s slice, is an error.
  • read_intoReads every range into out , whose byte n is the plan’s buffer byte n , at file position base + range.offset .

Methods and associated constants ​

new ​

pub fn new(meta: &Meta<'_>, cells: &[usize], o: ReadOptions) -> Result<Self>

Plans reads for cells (indices within one chunk’s metadata) under o.

Each cell’s record extent is collected, empty ones are dropped, the rest are sorted and deduplicated (two cells sharing a range read it once but slice it at their own positions), then merged across gaps of at most max_gap_bytes. Auto replaces the merged list with a single 0..records_len range when the merged bytes plus one request_cost_bytes per request reach the region length plus one request, i.e. when the ranges no longer save I/O.

ranges ​

pub fn ranges(&self) -> &[ReadRange]

The reads to issue, in buffer order.

summary ​

pub fn summary(&self) -> ReadSummary

What this plan reads, for cost accounting and tests.

record ​

pub fn record<'a>(&self, bytes: &'a [u8], position: usize) -> Result<&'a [u8]>

The position-th requested cell’s record, sliced from a buffer RecordReadPlan::read_into filled; empty records give an empty slice. A position past the plan, or a buffer that does not cover the record’s slice, is an error.

read_into ​

pub fn read_into(&self, file: &File, base: u64, out: &mut Vec<u8>) -> Result<()>

Reads every range into out, whose byte n is the plan’s buffer byte n, at file position base + range.offset.

out is resized to the plan’s read_bytes; since the ranges tile that buffer, no stale byte survives into a record.

Implemented traits ​

Contract reference ​

See the module reference for semantic input/output rules, units, allocation, mutation, failure behavior, and lifetime requirements. Declarations and documented members are synchronized from the crate source.

Definition