pub struct StoredEvent {
pub id: String,
pub raw: Bytes,
pub insertion_ts: u64,
pub shard_id: u16,
pub dedup_id: Option<String>,
}Expand description
An event retrieved from storage with its backend-specific ID.
Fields§
§id: StringBackend-specific identifier.
raw: BytesRaw JSON payload bytes (deferred parsing for performance).
insertion_ts: u64Insertion timestamp from ingestion.
shard_id: u16Shard this event belongs to.
dedup_id: Option<String>Application-level idempotency key as written by the producer.
Adapters carry an opaque dedup token on the wire (Redis Streams
uses a dedup_id field; JetStream uses Nats-Msg-Id). The
trait-level consumer (crate::adapter::Adapter::poll_shard)
surfaces it here so callers can drive their own dedup table
without re-reading the raw broker payload. None when the
adapter or the wire entry doesn’t carry one.
Implementations§
Source§impl StoredEvent
impl StoredEvent
Sourcepub fn new(id: String, raw: Bytes, insertion_ts: u64, shard_id: u16) -> Self
pub fn new(id: String, raw: Bytes, insertion_ts: u64, shard_id: u16) -> Self
Create a new stored event from raw bytes.
Sourcepub fn from_value(
id: String,
value: JsonValue,
insertion_ts: u64,
shard_id: u16,
) -> Self
pub fn from_value( id: String, value: JsonValue, insertion_ts: u64, shard_id: u16, ) -> Self
Create a new stored event from a JSON value (serializes once).
See RawEvent::from_value for the rationale on
unwrap_or_default() instead of expect().
Sourcepub fn with_dedup_id(self, dedup_id: Option<String>) -> Self
pub fn with_dedup_id(self, dedup_id: Option<String>) -> Self
Attach an application-level dedup identifier (the producer’s
dedup_id / Nats-Msg-Id). Returns self for chaining.
Trait Implementations§
Source§impl Clone for StoredEvent
impl Clone for StoredEvent
Source§fn clone(&self) -> StoredEvent
fn clone(&self) -> StoredEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more