use crate::batch_coordinator::CommitBatchResponse;
#[derive(Debug, Clone)]
pub struct ProduceResponse {
pub request_id: u32,
pub batch: CommittedBatch,
pub errors: Vec<String>, }
#[derive(Debug, Clone)]
pub struct CommittedBatch {
pub topic: Vec<u8>,
pub partition: Vec<u8>,
pub offset: u64,
pub size: u32,
}
impl From<&CommitBatchResponse> for ProduceResponse {
fn from(value: &CommitBatchResponse) -> Self {
ProduceResponse {
request_id: value.request.request_id,
errors: value.errors.clone(),
batch: CommittedBatch {
topic: value.request.topic_id_partition.0.as_bytes().to_vec(),
partition: value.request.topic_id_partition.1.clone(),
offset: value.request.base_offset,
size: value.request.size,
},
}
}
}