Expand description
Lazy, tombstone-aware sample iteration across series and chunks.
BlockReader::samples walks the whole block in one loop: series in
lexicographic order, chunks in time order, samples in time order, with
deleted samples filtered out. Nothing is buffered beyond one chunk, so a
block larger than memory streams at a constant footprint.
use tsdb_reader::{BlockReader, ReaderOptions, TimeRange};
let block = BlockReader::open("/data/01ARZ3NDEKTSV4RRFFQ69G5FAV".as_ref(), ReaderOptions::default())?;
let mut iter = block.samples(TimeRange::all());
while let Some(sample) = iter.next_sample()? {
println!("{} {}", sample.timestamp, sample.series.metric_name().unwrap_or(""));
}The lower-level API ( BlockReader::series plus crate::chunkenc::decode )
stays available for callers that need finer control, e.g. decoding all
samples of a chunk into one batch.
Structs§
- Sample
- One decoded sample, borrowed from the iterator’s scratch buffer.
- Sample
Iter Options - Knobs for
SampleIterator. - Sample
Iterator - Streams every sample of a block, filtered by time range and tombstones.
- Time
Range - Half-open time range
[start, end), in milliseconds since the Unix epoch.
Enums§
- Sample
Value - A decoded sample value.