pub struct ReplayEngine;Expand description
Folds a session’s events.jsonl into a ReconstructedState.
Implementations§
Source§impl ReplayEngine
impl ReplayEngine
Sourcepub async fn replay(
session_dir: &Path,
up_to: Option<u64>,
) -> Result<ReconstructedState, SessionError>
pub async fn replay( session_dir: &Path, up_to: Option<u64>, ) -> Result<ReconstructedState, SessionError>
Replay the session log at session_dir.
up_to, if set, is an exclusive upper bound on seq (used by ForkEngine to replay
only the prefix being copied). None replays the full log (resume).
Reads the log in bounded chunks (spec §6.2 step 3: ≤ 100 raw envelopes in memory at
once) rather than materializing the whole file’s parsed events into one Vec first —
unlike Self::fold, which operates on an already-materialized Vec for callers that
already hold the events in memory (e.g. llm_condenser.rs, which folds an
already-sliced sub-Vec). ForkEngine::fork copies raw events via
SessionEventLog::read_all directly and calls this method (not Self::fold) only to
validate the cut point.
§Errors
Returns SessionError::Io if the log cannot be opened/read.
Sourcepub fn fold(
events: Vec<SessionEventEnvelope>,
up_to: Option<u64>,
) -> ReconstructedState
pub fn fold( events: Vec<SessionEventEnvelope>, up_to: Option<u64>, ) -> ReconstructedState
Fold a sequence of envelopes already read from disk. Exposed separately from
Self::replay so callers that already hold the events (e.g. a live SessionActor
applying its own just-appended event, or llm_condenser.rs’s condense step folding an
already-sliced sub-Vec) can fold incrementally without re-reading the file.
Auto Trait Implementations§
impl Freeze for ReplayEngine
impl RefUnwindSafe for ReplayEngine
impl Send for ReplayEngine
impl Sync for ReplayEngine
impl Unpin for ReplayEngine
impl UnsafeUnpin for ReplayEngine
impl UnwindSafe for ReplayEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more