kf_protocol_message/kf_code_gen/
list_offset.rs

1/// WARNING: CODE GENERATED FILE
2/// * This file is generated by kfspec2code.
3/// * Any changes applied to this file will be lost when a new spec is generated.
4use serde::{Deserialize, Serialize};
5
6use kf_protocol_api::ErrorCode;
7use kf_protocol_api::Isolation;
8use kf_protocol_api::Request;
9
10use kf_protocol_derive::Decode;
11use kf_protocol_derive::Encode;
12use kf_protocol_derive::KfDefault;
13
14// -----------------------------------
15// KfListOffsetRequest
16// -----------------------------------
17
18#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
19pub struct KfListOffsetRequest {
20    /// The broker ID of the requestor, or -1 if this request is being made by a normal consumer.
21    pub replica_id: i32,
22
23    /// This setting controls the visibility of transactional records. Using READ_UNCOMMITTED
24    /// (isolation_level = 0) makes all records visible. With READ_COMMITTED (isolation_level = 1),
25    /// non-transactional and COMMITTED transactional records are visible. To be more concrete,
26    /// READ_COMMITTED returns all data from offsets smaller than the current LSO (last stable
27    /// offset), and enables the inclusion of the list of aborted transactions in the result, which
28    /// allows consumers to discard ABORTED transactional records
29    #[fluvio_kf(min_version = 2)]
30    pub isolation_level: Isolation,
31
32    /// Each topic in the request.
33    pub topics: Vec<ListOffsetTopic>,
34}
35
36
37
38#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
39pub struct ListOffsetTopic {
40    /// The topic name.
41    pub name: String,
42
43    /// Each partition in the request.
44    pub partitions: Vec<ListOffsetPartition>,
45}
46
47#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
48pub struct ListOffsetPartition {
49    /// The partition index.
50    pub partition_index: i32,
51
52    /// The current leader epoch.
53    #[fluvio_kf(min_version = 4)]
54    pub current_leader_epoch: i32,
55
56    /// The current timestamp.
57    pub timestamp: i64,
58}
59
60// -----------------------------------
61// KfListOffsetResponse
62// -----------------------------------
63
64#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
65pub struct KfListOffsetResponse {
66    /// The duration in milliseconds for which the request was throttled due to a quota violation,
67    /// or zero if the request did not violate any quota.
68    #[fluvio_kf(min_version = 2, ignorable)]
69    pub throttle_time_ms: i32,
70
71    /// Each topic in the response.
72    pub topics: Vec<ListOffsetTopicResponse>,
73}
74
75
76
77
78
79#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
80pub struct ListOffsetTopicResponse {
81    /// The topic name
82    pub name: String,
83
84    /// Each partition in the response.
85    pub partitions: Vec<ListOffsetPartitionResponse>,
86}
87
88#[derive(Encode, Decode, Serialize, Deserialize, KfDefault, Debug)]
89pub struct ListOffsetPartitionResponse {
90    /// The partition index.
91    pub partition_index: i32,
92
93    /// The partition error code, or 0 if there was no error.
94    pub error_code: ErrorCode,
95
96    /// The timestamp associated with the returned offset.
97    #[fluvio_kf(min_version = 1)]
98    pub timestamp: i64,
99
100    /// The returned offset.
101    #[fluvio_kf(min_version = 1)]
102    pub offset: i64,
103
104    #[fluvio_kf(min_version = 4)]
105    pub leader_epoch: i32,
106}
107
108// -----------------------------------
109// Implementation - KfListOffsetRequest
110// -----------------------------------
111
112impl Request for KfListOffsetRequest {
113    const API_KEY: u16 = 2;
114
115    const MIN_API_VERSION: i16 = 0;
116    const MAX_API_VERSION: i16 = 5;
117    const DEFAULT_API_VERSION: i16 = 5;
118
119    type Response = KfListOffsetResponse;
120}