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>
impl<S: HistorySink> SessionHistory<S>
pub fn new(session_id: &str, pairs: Vec<HistoryPairSpec<S>>) -> Self
Sourcepub fn max_cutoff_ms(&self) -> Option<i64>
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.
Sourcepub fn row(
&mut self,
key: i64,
created_at_ms: i64,
last_changed_at_ms: i64,
body_json: &str,
) -> Result<()>
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.
Sourcepub fn complete(
self,
fetch: &mut dyn RowFetch,
check: &dyn Fn() -> Result<()>,
) -> Result<Vec<HistoryResult<S::Done>>>
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.