#[non_exhaustive]pub struct StreamEvent {
pub seq: Option<u64>,
pub event: StreamResponse,
}Expand description
One event as it travels the queue, carrying the position it holds in the task’s event log.
The position is assigned once, by InMemoryQueueWriter::write, and then
travels on both channels — the persistence channel that writes the log
and the broadcast channel that feeds SSE. That is what makes the id: a
subscriber reads and the seq the store holds the same number by
construction rather than by agreement.
The alternative was to count frames at the SSE layer. It would agree with the log until the first lagged consumer, a snapshot frame, or a failed append, and a resumption offset that is off by one is worse than none: the client silently misses an event and has no way to know.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.seq: Option<u64>This event’s position in its task’s log, when it has one.
None for frames the server synthesized rather than the agent
emitting — the SubscribeToTask snapshot, and the terminal frame the
reattach hook builds from stored state. Those are not in the log, so
they carry no id: and a resuming client’s offset is unaffected by
having seen them.
event: StreamResponseWhat the agent emitted.
Implementations§
Source§impl StreamEvent
impl StreamEvent
Sourcepub const fn at(seq: u64, event: StreamResponse) -> StreamEvent
pub const fn at(seq: u64, event: StreamResponse) -> StreamEvent
An event at a known log position.
Sourcepub const fn unpositioned(event: StreamResponse) -> StreamEvent
pub const fn unpositioned(event: StreamResponse) -> StreamEvent
An event with no log position: synthesized by the server, not emitted by the agent.
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§fn clone(&self) -> StreamEvent
fn clone(&self) -> StreamEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
impl UnwindSafe for StreamEvent
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request