Skip to main content

PreparedSeriesSource

Trait PreparedSeriesSource 

Source
pub trait PreparedSeriesSource: Send + Sync {
    // Required methods
    fn num_series(&self) -> usize;
    fn label_source(&self) -> &RawLabelSource;
    fn series_info(&self, ordinal: usize) -> Result<SeriesInfo, BoxedError>;
    fn read_series(
        &self,
        range: Range<usize>,
    ) -> Result<SendableRawSeriesStream, BoxedError>;
}
Expand description

An immutable, finite selected set of series prepared for independent range reads.

The count may include series with no samples after filtering. Ordinals are stable local indexes, not protocol identifiers; each has exactly one complete identity returned by PreparedSeriesSource::series_info, and that identity matches chunks for that ordinal. Every reader exposes the same fixed schema, label binding, and ordering before polling, including for an empty range, and describes labels independently of this source’s lifetime. Key-encoded output has metric: None; explicit-label output has a complete Some(metric) matching each chunk, independently of its scan binding. Ordering describes the stream, not ordinal enumeration.

Preparation, identity lookup, and reader creation do not load sample payloads or perform hidden blocking I/O. The selected set is bound to the scanner’s immutable MVCC view, predicates, authorization, projection, labels, and existing scan resources. Readers own resources needed to continue after this source or scanner is dropped. Dropping one reader does not cancel sibling readers; normal ownership cleanup applies without detached work.

A range must satisfy start <= end <= num_series(). Invalid ranges and invalid ordinals return errors; an empty in-bounds range returns an ordinary empty stream. Repeated and overlapping reads are independent and do not consume shared iteration state.

Required Methods§

Source

fn num_series(&self) -> usize

Returns the exact, stable number of selected local series ordinals.

Source

fn label_source(&self) -> &RawLabelSource

Returns label binding shared by series metadata and every reader, without opening or polling a reader; the binding is self-contained for remote consumers.

Source

fn series_info(&self, ordinal: usize) -> Result<SeriesInfo, BoxedError>

Returns identity metadata for an ordinal without polling sample data.

Source

fn read_series( &self, range: Range<usize>, ) -> Result<SendableRawSeriesStream, BoxedError>

Creates an independent reader for the half-open ordinal range.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§