pub struct SessionPersistenceSink { /* private fields */ }Expand description
An EventSink that persists every AgentEvent::MessageAppended event
to the session transcript file.
Wraps an Arc<Mutex<SessionWriter>> and calls
SessionWriter::append on every MessageAppended event. All other
event variants are silently ignored.
Persistence failures are non-fatal for the agent run but are logged at
error level because a missing line on disk would silently break
downstream orphan detection (g153).
§Locking notes
SessionWriter is not Send across .await points, so we keep the
mutex non-async (std::sync::Mutex). The critical section inside
emit is purely synchronous I/O — one serde_json::to_string +
write_all + flush per message — matching every other consumer of
Arc<Mutex<SessionWriter>> in the codebase.
Implementations§
Source§impl SessionPersistenceSink
impl SessionPersistenceSink
Sourcepub fn new(writer: Arc<Mutex<SessionWriter>>) -> Self
pub fn new(writer: Arc<Mutex<SessionWriter>>) -> Self
Create a new SessionPersistenceSink backed by the given writer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionPersistenceSink
impl RefUnwindSafe for SessionPersistenceSink
impl Send for SessionPersistenceSink
impl Sync for SessionPersistenceSink
impl Unpin for SessionPersistenceSink
impl UnsafeUnpin for SessionPersistenceSink
impl UnwindSafe for SessionPersistenceSink
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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