1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use crate::core::Encoder;
use crate::core::Decoder;
use crate::derive::FluvioDefault;
use crate::ErrorCode;
#[derive(Encoder, Decoder, FluvioDefault, Debug)]
pub struct ProduceResponse {
pub responses: Vec<TopicProduceResponse>,
#[fluvio(min_version = 1, ignorable)]
pub throttle_time_ms: i32,
}
impl ProduceResponse {
pub fn find_partition_response(
&self,
topic: &str,
partition: i32,
) -> Option<&PartitionProduceResponse> {
if let Some(response) = self
.responses
.iter()
.find(|response| response.name == topic)
{
response
.partitions
.iter()
.find(|part_response| part_response.partition_index == partition)
} else {
None
}
}
}
#[derive(Encoder, Decoder, FluvioDefault, Debug)]
pub struct TopicProduceResponse {
pub name: String,
pub partitions: Vec<PartitionProduceResponse>,
}
#[derive(Encoder, Decoder, FluvioDefault, Debug)]
pub struct PartitionProduceResponse {
pub partition_index: i32,
pub error_code: ErrorCode,
pub base_offset: i64,
#[fluvio(min_version = 2, ignorable)]
pub log_append_time_ms: i64,
#[fluvio(min_version = 5, ignorable)]
pub log_start_offset: i64,
}