Struct MetricsLogReader

Source
pub struct MetricsLogReader<R: Read> {
    pub header: LogHeader,
    /* private fields */
}
Expand description

A streaming reader for metric logs. If the underlying reader supports seeks, it is possible to get SeekTokens which may be used to seek to previous frames in the stream.

Fields§

§header: LogHeader

Implementations§

Source§

impl<R: Read> MetricsLogReader<R>

Source

pub fn new(reader: R) -> Result<Self>

Constructs a bare metrics log reader.

Source

pub fn read_frame( &mut self, ) -> Result<Option<(UnixTimestampMilliseconds, Frame)>>

Reads a frame. Returns the start time of the frame and the frame itself.

Source§

impl<R: Read + Seek> MetricsLogReader<R>

Source

pub fn read_frame_rewindable( &mut self, ) -> Result<Option<(SeekToken, UnixTimestampMilliseconds, Frame)>>

Reads a new frame, and returns a seek token that can be used to rewind such that you can ‘undo’ the read.

Source

pub fn seek(&mut self, seek_token: SeekToken) -> Result<SeekToken>

Seeks to a position in the stream. The given seek token MUST have come from this instance’s read_from_rewindable function. Otherwise, corrupt frames may be read. The old position is returned as a seek token.

Auto Trait Implementations§

§

impl<R> Freeze for MetricsLogReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for MetricsLogReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for MetricsLogReader<R>
where R: Send,

§

impl<R> Sync for MetricsLogReader<R>
where R: Sync,

§

impl<R> Unpin for MetricsLogReader<R>
where R: Unpin,

§

impl<R> UnwindSafe for MetricsLogReader<R>
where R: 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.