pub struct EventRequest {
pub event_type: String,
pub ts: DateTime<Utc>,
pub session_id: SessionId,
pub context: EventContext,
pub data: EventData,
pub metadata: Option<Value>,
pub tags: Option<Vec<String>>,
}Expand description
Request to create a new event.
This is the input type for event ingestion. It contains all the data
needed to create an event, but without the id and sequence fields
which are assigned by the storage layer.
Fields§
§event_type: StringEvent type in dot notation
ts: DateTime<Utc>Event timestamp
session_id: SessionIdSession this event belongs to
context: EventContextCorrelation context
data: EventDataEvent-specific payload
metadata: Option<Value>Arbitrary metadata for the event
Tags for filtering and categorization
Implementations§
Source§impl EventRequest
impl EventRequest
Sourcepub fn new(
session_id: SessionId,
context: EventContext,
data: impl Into<EventData>,
) -> Self
pub fn new( session_id: SessionId, context: EventContext, data: impl Into<EventData>, ) -> Self
Create a new event request with the given session_id, context, and typed data
The event type is automatically inferred from the data type.
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Set metadata
Set tags
Sourcepub fn is_ephemeral(&self) -> bool
pub fn is_ephemeral(&self) -> bool
Whether this event is ephemeral (high-frequency streaming deltas that don’t need durable storage). Delivery backends that support ephemeral routing can publish these events without inserting them into PostgreSQL.
The authoritative content lives in the corresponding “completed” event
(e.g. output.message.completed has the full text), so missing a delta
on reconnect is acceptable.
Sourcepub fn into_event(self, id: EventId, sequence: i32) -> Event
pub fn into_event(self, id: EventId, sequence: i32) -> Event
Convert to an Event with the given id and sequence
Trait Implementations§
Source§impl Clone for EventRequest
impl Clone for EventRequest
Source§fn clone(&self) -> EventRequest
fn clone(&self) -> EventRequest
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 EventRequest
impl Debug for EventRequest
Source§impl<'de> Deserialize<'de> for EventRequest
impl<'de> Deserialize<'de> for EventRequest
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 EventRequest
impl RefUnwindSafe for EventRequest
impl Send for EventRequest
impl Sync for EventRequest
impl Unpin for EventRequest
impl UnsafeUnpin for EventRequest
impl UnwindSafe for EventRequest
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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