riskless/messages/
commit_batch_request.rs1#![allow(dead_code)]
2
3use crate::batch_coordinator::{TimestampType, TopicIdPartition};
4
5use super::batch_coordinate::BatchCoordinate;
6
7#[derive(Debug, Clone)]
10pub struct CommitBatchRequest {
11 pub request_id: u32,
13 pub topic_id_partition: TopicIdPartition,
15 pub byte_offset: u64,
17 pub size: u32,
19 pub base_offset: u64,
21 pub last_offset: u64,
23 pub batch_max_timestamp: u64,
25 pub message_timestamp_type: TimestampType,
27 pub producer_id: u64,
29 pub producer_epoch: u16,
31 pub base_sequence: u32,
33 pub last_sequence: u32,
35}
36
37impl From<&BatchCoordinate> for CommitBatchRequest {
38 fn from(value: &BatchCoordinate) -> Self {
39 CommitBatchRequest {
41 request_id: value.request.request_id,
42 topic_id_partition: TopicIdPartition(value.topic.clone(), value.partition.clone()),
43 byte_offset: value.offset,
44 size: value.size,
45 base_offset: value.base_offset,
46 last_offset: Default::default(),
47 batch_max_timestamp: Default::default(),
48 message_timestamp_type: TimestampType::Dummy,
49 producer_id: Default::default(),
50 producer_epoch: Default::default(),
51 base_sequence: Default::default(),
52 last_sequence: Default::default(),
53 }
54 }
55}