Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/core/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,17 @@ impl Timeline {
timeline
}

/// Fold records a client already holds, without cloning their payloads:
/// a history page refolds the whole held log, whose tool outputs and
/// diffs are the bulk of it.
pub fn fold_stored<'a>(records: impl IntoIterator<Item = &'a StoredEvent>) -> Self {
let mut timeline = Self::default();
for record in records {
timeline.apply_stored(record);
}
timeline
}

/// Fold one record, remembering whether it carried a shortened output.
pub fn apply_stored(&mut self, stored: &StoredEvent) {
if let Some(bytes) = stored.elided
Expand Down
Loading