use bytes::Bytes;
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct FetchResponse {
pub(crate) throttle_time_ms: u32,
pub(crate) error_code: i16,
pub(crate) session_id: i32,
pub(crate) topics: Vec<FetchTopic>,
pub(crate) endpoints: Vec<FetchEndpoint>,
}
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct FetchTopic {
pub(crate) name: Bytes,
pub(crate) topic_id: [u8; 16],
pub(crate) partitions: Vec<FetchPartition>,
}
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct FetchPartition {
pub(crate) index: u32,
pub(crate) error_code: i16,
pub(crate) high_watermark: Option<i64>,
pub(crate) last_stable_offset: Option<i64>,
pub(crate) log_start_offset: Option<i64>,
pub(crate) diverging_epoch: Option<FetchEpochEndOffset>,
pub(crate) current_leader: Option<FetchLeader>,
pub(crate) snapshot_id: Option<FetchEpochEndOffset>,
pub(crate) preferred_read_replica: Option<i32>,
pub(crate) aborted_transactions: Vec<FetchAbortedTransaction>,
pub(crate) batches: Vec<FetchBatch>,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) struct FetchEpochEndOffset {
pub(crate) epoch: i32,
pub(crate) end_offset: i64,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) struct FetchLeader {
pub(crate) broker_id: i32,
pub(crate) epoch: i32,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) struct FetchAbortedTransaction {
pub(crate) producer_id: i64,
pub(crate) first_offset: i64,
}
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct FetchEndpoint {
pub(crate) node_id: i32,
pub(crate) host: Bytes,
pub(crate) port: u16,
pub(crate) rack: Option<Bytes>,
}
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct FetchBatch {
pub(crate) base_offset: i64,
pub(crate) last_offset: i64,
pub(crate) next_offset: i64,
pub(crate) partition_leader_epoch: Option<i32>,
pub(crate) timestamp_type: FetchTimestampType,
pub(crate) max_timestamp: Option<i64>,
pub(crate) producer: Option<FetchProducerIdentity>,
pub(crate) is_transactional: bool,
pub(crate) is_control: bool,
pub(crate) delete_horizon_ms: Option<i64>,
pub(crate) records: Vec<FetchRecord>,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) struct FetchProducerIdentity {
pub(crate) producer_id: i64,
pub(crate) producer_epoch: i16,
pub(crate) base_sequence: i32,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum FetchTimestampType {
Create,
LogAppend,
}
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct FetchRecord {
pub(crate) attributes: i8,
pub(crate) offset: i64,
pub(crate) timestamp: Option<i64>,
pub(crate) key: Option<Bytes>,
pub(crate) value: Option<Bytes>,
pub(crate) headers: Vec<FetchHeader>,
}
#[derive(Debug, Eq, PartialEq)]
pub(crate) struct FetchHeader {
pub(crate) key: Bytes,
pub(crate) value: Option<Bytes>,
}