pub struct SessionEventEnvelope {
pub session_id: String,
pub seq: u64,
pub at: DateTime<Utc>,
pub kind: String,
pub event: Event,
}Expand description
The stable, sequenced wire envelope for one session’s event (#2055).
Why: session.attach’s ring-buffer replay and every live notification
thereafter (both STDIO session.event notifications and the HTTP
GET /sessions/{id}/events SSE stream) need the SAME shape so a client
can detect gaps and stitch replay -> live into one ordered stream. See
the module docs for how this aligns with / diverges from
trusty-agents-common’s HarnessEvent convention.
What: session_id (always present — every event this daemon emits is
session-scoped), seq (per-session monotonic, assigned by
session::registry::SessionRegistry::record, starting at 1), at (UTC
emit timestamp), kind (== event.kind(), duplicated at the top level
for cheap client-side filtering), and event (the full tagged payload).
Test: session_event_envelope_round_trips_through_json.
Fields§
§session_id: String§seq: u64§at: DateTime<Utc>§kind: String§event: EventImplementations§
Source§impl SessionEventEnvelope
impl SessionEventEnvelope
Sourcepub fn new(
session_id: String,
seq: u64,
at: DateTime<Utc>,
event: Event,
) -> Self
pub fn new( session_id: String, seq: u64, at: DateTime<Utc>, event: Event, ) -> Self
Build an envelope for event, computing kind from
Event::kind.
Why: the one place kind is derived from event, so the two can
never be constructed out of sync.
What: session_id/seq/at are supplied by the caller (the
registry, which owns the per-session sequence counter); kind is
computed here.
Test: session_event_envelope_round_trips_through_json.
Trait Implementations§
Source§impl Clone for SessionEventEnvelope
impl Clone for SessionEventEnvelope
Source§fn clone(&self) -> SessionEventEnvelope
fn clone(&self) -> SessionEventEnvelope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionEventEnvelope
impl Debug for SessionEventEnvelope
Source§impl<'de> Deserialize<'de> for SessionEventEnvelope
impl<'de> Deserialize<'de> for SessionEventEnvelope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SessionEventEnvelope
impl RefUnwindSafe for SessionEventEnvelope
impl Send for SessionEventEnvelope
impl Sync for SessionEventEnvelope
impl Unpin for SessionEventEnvelope
impl UnsafeUnpin for SessionEventEnvelope
impl UnwindSafe for SessionEventEnvelope
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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