pub struct WrittenRecord<'a> { /* private fields */ }
Expand description
A written Record
within Redpanda.
A WrittenRecord
is handed to on_record_written
event handlers as the record that Redpanda
wrote. The record contains a key value pair with some headers, along with the record’s
timestamp.
Implementations§
Source§impl<'a> WrittenRecord<'a>
impl<'a> WrittenRecord<'a>
Sourcepub fn from_record(
record: impl Into<BorrowedRecord<'a>>,
timestamp: SystemTime,
) -> WrittenRecord<'a>
pub fn from_record( record: impl Into<BorrowedRecord<'a>>, timestamp: SystemTime, ) -> WrittenRecord<'a>
Create a new record without any copies.
NOTE: This method is useful for tests to mock out custom events to your transform function.
Sourcepub fn new(
key: Option<&'a [u8]>,
value: Option<&'a [u8]>,
timestamp: SystemTime,
) -> WrittenRecord<'a>
pub fn new( key: Option<&'a [u8]>, value: Option<&'a [u8]>, timestamp: SystemTime, ) -> WrittenRecord<'a>
Create a new record without any copies.
NOTE: This method is useful for tests to mock out custom events to your transform function.
Sourcepub fn new_with_headers(
key: Option<&'a [u8]>,
value: Option<&'a [u8]>,
timestamp: SystemTime,
headers: Vec<BorrowedHeader<'a>>,
) -> WrittenRecord<'a>
pub fn new_with_headers( key: Option<&'a [u8]>, value: Option<&'a [u8]>, timestamp: SystemTime, headers: Vec<BorrowedHeader<'a>>, ) -> WrittenRecord<'a>
Create a new record without any copies.
NOTE: This method is useful for tests to mock out custom events to your transform function.
Sourcepub fn value(&self) -> Option<&'a [u8]>
pub fn value(&self) -> Option<&'a [u8]>
Returns the record’s value or None
if there is no value.
Sourcepub fn timestamp(&self) -> SystemTime
pub fn timestamp(&self) -> SystemTime
Returns the record’s timestamp.
NOTE: Record timestamps in Redpanda have millisecond resolution.
Sourcepub fn headers(&self) -> &[BorrowedHeader<'a>]
pub fn headers(&self) -> &[BorrowedHeader<'a>]
Return the headers for this record.