pub struct Partition {
pub id: i32,
pub messages: VecDeque<KafkaMessage>,
pub high_watermark: i64,
pub log_start_offset: i64,
}Expand description
Represents a Kafka partition
Fields§
§id: i32§messages: VecDeque<KafkaMessage>§high_watermark: i64§log_start_offset: i64Implementations§
Source§impl Partition
impl Partition
Sourcepub fn append(&mut self, message: KafkaMessage) -> i64
pub fn append(&mut self, message: KafkaMessage) -> i64
Append a message to the partition
Sourcepub fn fetch(&self, offset: i64, max_bytes: i32) -> Vec<&KafkaMessage>
pub fn fetch(&self, offset: i64, max_bytes: i32) -> Vec<&KafkaMessage>
Fetch messages from a given offset
Sourcepub fn latest_offset(&self) -> i64
pub fn latest_offset(&self) -> i64
Get the latest offset
Sourcepub fn has_offset(&self, offset: i64) -> bool
pub fn has_offset(&self, offset: i64) -> bool
Check if partition has messages from offset
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Partition
impl RefUnwindSafe for Partition
impl Send for Partition
impl Sync for Partition
impl Unpin for Partition
impl UnwindSafe for Partition
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