Skip to main content

SessionHistory

Struct SessionHistory 

Source
pub struct SessionHistory<S> { /* private fields */ }
Expand description

Renders one session’s rows for several items at once. Rows are read twice, in the same snapshot: count_row over all of them fixes each header, then row over them in (position, stable_id) order renders each exactly once and hands it to every pair that includes it. The rendered text is byte-identical to the whole-string rendering of the frozen format; it is never held whole. complete then renders again, once, only the rows around the windows the sinks selected.

Implementations§

Source§

impl<S: HistorySink> SessionHistory<S>

Source

pub fn new(session_id: &str, pairs: Vec<HistoryPairSpec<S>>) -> Self

Source

pub fn max_cutoff_ms(&self) -> Option<i64>

The latest cutoff of any pair. A row created or changed after it is withheld from every pair, so it only needs counting.

Source

pub fn count_row(&mut self, row: &RowMeta<'_>)

First pass.

Source

pub fn begin(&mut self) -> Result<()>

Writes every header; call once between the passes.

Source

pub fn row( &mut self, key: i64, created_at_ms: i64, last_changed_at_ms: i64, body_json: &str, ) -> Result<()>

Second pass, over the rows in order. key is how RowFetch finds the row again. Rows nobody includes are not decoded; rows of a kind that never renders may be left out.

Source

pub fn complete( self, fetch: &mut dyn RowFetch, check: &dyn Fn() -> Result<()>, ) -> Result<Vec<HistoryResult<S::Done>>>

Ends every transcript, lets each sink select its windows, and renders the rows around the selected windows again, once for all of them, with fetch reading the same rows as the passes did. Fails when the second pass disagrees with the counts in the headers, which means the rows changed between the passes or the counting query drifted from the renderer. check is called often; an error from it ends the work.

Auto Trait Implementations§

§

impl<S> Forget for SessionHistory<S>

§

impl<S> Freeze for SessionHistory<S>
where Vec<PairRender<S>>: Freeze,

§

impl<S> Move for SessionHistory<S>

§

impl<S> RefUnwindSafe for SessionHistory<S>
where Vec<PairRender<S>>: RefUnwindSafe,

§

impl<S> Send for SessionHistory<S>
where Vec<PairRender<S>>: Send,

§

impl<S> Sync for SessionHistory<S>
where Vec<PairRender<S>>: Sync,

§

impl<S> Unpin for SessionHistory<S>
where Vec<PairRender<S>>: Unpin,

§

impl<S> UnsafeUnpin for SessionHistory<S>
where Vec<PairRender<S>>: UnsafeUnpin,

§

impl<S> UnwindSafe for SessionHistory<S>
where Vec<PairRender<S>>: 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more