Skip to main content

SampleIterator

Struct SampleIterator 

Source
pub struct SampleIterator<'a> { /* private fields */ }
Expand description

Streams every sample of a block, filtered by time range and tombstones.

Created by BlockReader::samples or SampleIterator::new; the latter works on the parts returned by BlockReader::into_parts, which is how a worker thread gets its own iterator without sharing the index.

Implementations§

Source§

impl<'a> SampleIterator<'a>

Source

pub fn new( index: &'a IndexReader, chunks: &'a ChunkReader, tombstones: &'a Tombstones, opts: SampleIterOptions, ) -> Self

Builds an iterator over the parts of a block.

Source

pub fn options(&self) -> &SampleIterOptions

Options this iterator was built with.

Source

pub fn index(&self) -> &'a IndexReader

The index being read.

Source

pub fn samples_emitted(&self) -> u64

Samples returned so far.

Source

pub fn chunks_decoded(&self) -> u64

Chunks decoded so far, i.e. chunks that overlapped the range.

Source

pub fn samples_filtered(&self) -> u64

Samples skipped because they were outside the range or tombstoned.

Source

pub fn next_sample(&mut self) -> Result<Option<Sample<'_>>>

Returns the next sample, or None at the end of the block.

Chunks are decoded one at a time into a reused buffer, so memory stays bounded by the largest chunk, not by the block.

Auto Trait Implementations§

§

impl<'a> Forget for SampleIterator<'a>

§

impl<'a> Freeze for SampleIterator<'a>

§

impl<'a> Move for SampleIterator<'a>

§

impl<'a> RefUnwindSafe for SampleIterator<'a>
where OnceLock<Arc<PostingsTable>>: RefUnwindSafe, Atomic<usize>: RefUnwindSafe,

§

impl<'a> Send for SampleIterator<'a>
where &'a IndexReader: Send, &'a ChunkReader: Send, &'a Tombstones: Send, RawVecInner: Send, Arc<str>: Send,

§

impl<'a> Sync for SampleIterator<'a>
where MmapInner: Sync, RawVecInner: Sync, OnceLock<Arc<PostingsTable>>: Sync, RawTable<(u64, Vec<(i64, i64)>)>: Sync, Arc<str>: Sync,

§

impl<'a> Unpin for SampleIterator<'a>
where &'a IndexReader: Unpin, &'a ChunkReader: Unpin, &'a Tombstones: Unpin, *const u8 is !null: Unpin, Arc<str>: Unpin,

§

impl<'a> UnsafeUnpin for SampleIterator<'a>

§

impl<'a> UnwindSafe for SampleIterator<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.