pub struct ProducerState {
pub producer_id: u64,
pub producer_epoch: u16,
pub partition_sequences: HashMap<(String, u32), i32>,
pub next_sequence: i32,
}Expand description
State for an idempotent/transactional producer
Fields§
§producer_id: u64Producer ID assigned by the broker
producer_epoch: u16Current epoch (increments on reconnect)
partition_sequences: HashMap<(String, u32), i32>Per-partition sequence numbers for idempotent produce. When the client specifies a partition, the per-partition sequence is used for correct broker-side deduplication. Key: (topic, partition), Value: next sequence number.
next_sequence: i32Global sequence counter used when the partition is server-assigned (partition=None). The broker tracks this per producer_id.
Implementations§
Source§impl ProducerState
impl ProducerState
Sourcepub fn next_sequence_for(&mut self, topic: &str, partition: u32) -> i32
pub fn next_sequence_for(&mut self, topic: &str, partition: u32) -> i32
Get the next sequence number for a specific topic-partition, initializing to 1 if this is the first message to that partition.
Trait Implementations§
Source§impl Clone for ProducerState
impl Clone for ProducerState
Source§fn clone(&self) -> ProducerState
fn clone(&self) -> ProducerState
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 moreAuto Trait Implementations§
impl Freeze for ProducerState
impl RefUnwindSafe for ProducerState
impl Send for ProducerState
impl Sync for ProducerState
impl Unpin for ProducerState
impl UnsafeUnpin for ProducerState
impl UnwindSafe for ProducerState
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