Skip to main content

MergeRecordDecoder

Struct MergeRecordDecoder 

Source
pub struct MergeRecordDecoder<D> { /* private fields */ }
Expand description

Merges the record decoding streams from one or more other decoders, performing a k-merge based on Record::index_ts().

Implementations§

Source§

impl<D> RecordDecoder<D>
where D: DecodeRecordRef,

Source

pub fn new(decoders: Vec<D>) -> Result<Self>

Creates a new record-stream merging decoder.

§Errors

This function returns an error if decoders is empty. It will also return an error if one of the inner decoders returns an error while decoding the first record. A decoder returning Ok(None) does not result in a failure.

Source

pub fn with_hints(decoders: Vec<D>, start_ts_hints: Vec<u64>) -> Result<Self>

Creates a new record-stream merging decoder with a hint for the start time for each decoder. This can assist the merger to avoid reading from a decoder before necessary.

The hint timestamp must be <= raw_index_ts() of the first record in the file. Metadata::start is an example source of for hint.

§Errors

This function returns an error if decoders is empty or decoders and start_ts_hints are of different lengths. It will also return an error if one of the inner decoders returns an error while decoding the first record. A decoder returning Ok(None) does not result in a failure.

Trait Implementations§

Source§

impl<D> DecodeRecord for RecordDecoder<D>
where D: LastRecord + DecodeRecordRef,

Source§

fn decode_record<T: HasRType>(&mut self) -> Result<Option<&T>>

Tries to decode a reference to a single record of type T. Returns Ok(None) if the input has been exhausted. Read more
Source§

fn decode_records<T: HasRType + Clone>(self) -> Result<Vec<T>>
where Self: Sized,

Tries to decode all records into a Vec. This eagerly decodes the data. Read more
Source§

impl<D> DecodeRecordRef for RecordDecoder<D>
where D: LastRecord + DecodeRecordRef,

Source§

fn decode_record_ref(&mut self) -> Result<Option<RecordRef<'_>>>

Tries to decode a generic reference a record. Returns Ok(None) if input has been exhausted. Read more
Source§

fn decode_buf_iter(&mut self) -> impl Iterator<Item = Result<RecordBuf>> + '_

Returns an Iterator of owned RecordBufs decoded from this reader. Read more
Source§

impl<D> DecodeStream for RecordDecoder<D>
where D: LastRecord + DecodeRecordRef,

Source§

fn decode_stream<T: HasRType>(self) -> StreamIterDecoder<Self, T>
where Self: Sized,

Converts the decoder into a streaming iterator of records of type T. This lazily decodes the data.

Auto Trait Implementations§

§

impl<D> Freeze for RecordDecoder<D>

§

impl<D> RefUnwindSafe for RecordDecoder<D>
where D: RefUnwindSafe,

§

impl<D> Send for RecordDecoder<D>
where D: Send,

§

impl<D> Sync for RecordDecoder<D>
where D: Sync,

§

impl<D> Unpin for RecordDecoder<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for RecordDecoder<D>

§

impl<D> UnwindSafe for RecordDecoder<D>
where D: UnwindSafe,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> Ungil for T
where T: Send,