pub struct RecordMetadata { /* private fields */ }Expand description
The metadata for a record that has been acknowledged by the server.
Implementations§
Source§impl RecordMetadata
impl RecordMetadata
Sourcepub const UNKNOWN_PARTITION: i32 = -1
pub const UNKNOWN_PARTITION: i32 = -1
Partition value for record without partition assigned.
Sourcepub fn new(
topic_partition: TopicPartition,
base_offset: i64,
batch_index: i32,
timestamp: i64,
serialized_key_size: i32,
serialized_value_size: i32,
) -> Self
pub fn new( topic_partition: TopicPartition, base_offset: i64, batch_index: i32, timestamp: i64, serialized_key_size: i32, serialized_value_size: i32, ) -> Self
Creates a new instance with the provided parameters.
§Arguments
topic_partition- the partitionbase_offset- the batch offsetbatch_index- the record’s indextimestamp- the timestampserialized_key_size- the key sizeserialized_value_size- the value size
Sourcepub fn has_offset(&self) -> bool
pub fn has_offset(&self) -> bool
Indicates whether the record metadata includes the offset.
§Returns
true if the offset is included in the metadata, false otherwise.
Sourcepub fn offset(&self) -> i64
pub fn offset(&self) -> i64
The offset of the record in the topic/partition.
Returns -1 if has_offset() returns false.
§Returns
the offset of the record, or -1 if Self::has_offset returns false.
Sourcepub fn has_timestamp(&self) -> bool
pub fn has_timestamp(&self) -> bool
Indicates whether the record metadata includes the timestamp.
§Returns
true if a valid timestamp exists, false otherwise.
Sourcepub fn timestamp(&self) -> i64
pub fn timestamp(&self) -> i64
The timestamp of the record in the topic/partition.
Returns -1 if has_timestamp() returns false.
§Returns
the timestamp of the record, or -1 if the Self::has_timestamp returns false.
Sourcepub fn serialized_key_size(&self) -> i32
pub fn serialized_key_size(&self) -> i32
Returns the size of the serialized, uncompressed key in bytes. If key
is None, the returned size is -1.
Sourcepub fn serialized_value_size(&self) -> i32
pub fn serialized_value_size(&self) -> i32
Returns the size of the serialized, uncompressed value in bytes. If
value is None, the returned size is -1.
Trait Implementations§
Source§impl Clone for RecordMetadata
impl Clone for RecordMetadata
Source§fn clone(&self) -> RecordMetadata
fn clone(&self) -> RecordMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more