pub struct EventRecord {
pub stream_name: String,
pub id: Uuid,
pub kind: EventKind,
pub data: Bytes,
pub meta: Bytes,
pub position: i64,
}
Expand description
A record of an event. This is designed to represent events in a log, and so
it has more fields than a CacheRecord
.
- The
stream_name
field is the name of the stream that the event is in. - The
id
field is a unique identifier for the event. - The
kind
field is the kind of event. - The
data
field is the main data of the event. - The
meta
field is for additional information that may be useful, like timestamps or other bits that might not make sense to store in thedata
field. - The
position
field is the position of the event in the stream, and is used to order events in the log.
Event records are stored, not ephemeral, but they’re designed to easily be turned into frames and back again. This means that in a system of high traffic, it might be better to use frames directly, and then convert them to records only at the point where they absolutely need to be stored or distributed.
Fields§
§stream_name: String
The name of the stream that the event is in.
id: Uuid
The unique identifier of the event.
kind: EventKind
The kind of event.
data: Bytes
The main data of the event.
meta: Bytes
Any additional metadata.
position: i64
The position of the event in the stream.
Implementations§
Source§impl EventRecord
impl EventRecord
Sourcepub fn new(
stream_name: impl AsRef<str>,
kind: EventKind,
data: impl Into<Bytes>,
meta: impl Into<Bytes>,
position: impl Into<i64>,
) -> Self
pub fn new( stream_name: impl AsRef<str>, kind: EventKind, data: impl Into<Bytes>, meta: impl Into<Bytes>, position: impl Into<i64>, ) -> Self
Create a new event record.
Sourcepub fn entry(
stream_name: impl AsRef<str>,
data: impl Into<Bytes>,
meta: impl Into<Bytes>,
position: impl Into<i64>,
) -> Self
pub fn entry( stream_name: impl AsRef<str>, data: impl Into<Bytes>, meta: impl Into<Bytes>, position: impl Into<i64>, ) -> Self
Create a new entry event record.
Sourcepub fn marker(
stream_name: impl AsRef<str>,
data: impl Into<Bytes>,
meta: impl Into<Bytes>,
position: impl Into<i64>,
) -> Self
pub fn marker( stream_name: impl AsRef<str>, data: impl Into<Bytes>, meta: impl Into<Bytes>, position: impl Into<i64>, ) -> Self
Create a new marker event record.
Sourcepub fn set_position(self, position: impl Into<i64>) -> Self
pub fn set_position(self, position: impl Into<i64>) -> Self
Set the position of the event in the stream.
Trait Implementations§
Source§impl Clone for EventRecord
impl Clone for EventRecord
Source§fn clone(&self) -> EventRecord
fn clone(&self) -> EventRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for EventRecord
impl Debug for EventRecord
Source§impl Default for EventRecord
impl Default for EventRecord
Source§fn default() -> EventRecord
fn default() -> EventRecord
Returns the “default value” for a type. Read more
Source§impl From<Event> for EventRecord
impl From<Event> for EventRecord
Source§impl From<EventRecord> for Frame
impl From<EventRecord> for Frame
Source§fn from(record: EventRecord) -> Self
fn from(record: EventRecord) -> Self
Converts to this type from the input type.
Source§impl IntoEvent for EventRecord
impl IntoEvent for EventRecord
Source§fn into_event(self) -> Event
fn into_event(self) -> Event
Consume the type, producing an
Event
Auto Trait Implementations§
impl !Freeze for EventRecord
impl RefUnwindSafe for EventRecord
impl Send for EventRecord
impl Sync for EventRecord
impl Unpin for EventRecord
impl UnwindSafe for EventRecord
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
Mutably borrows from an owned value. Read more