#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DescribeMetadataQuorumReplica {
pub(super) replica_id: i32,
pub(super) replica_directory_id: Option<[u8; 16]>,
pub(super) log_end_offset: Option<i64>,
pub(super) last_fetch_timestamp_ms: Option<i64>,
pub(super) last_caught_up_timestamp_ms: Option<i64>,
}
impl DescribeMetadataQuorumReplica {
pub const fn replica_id(&self) -> i32 {
self.replica_id
}
pub const fn replica_directory_id(&self) -> Option<[u8; 16]> {
self.replica_directory_id
}
pub const fn log_end_offset(&self) -> Option<i64> {
self.log_end_offset
}
pub const fn last_fetch_timestamp_ms(&self) -> Option<i64> {
self.last_fetch_timestamp_ms
}
pub const fn last_caught_up_timestamp_ms(&self) -> Option<i64> {
self.last_caught_up_timestamp_ms
}
#[allow(clippy::type_complexity)]
pub fn into_parts(self) -> (i32, Option<[u8; 16]>, Option<i64>, Option<i64>, Option<i64>) {
(
self.replica_id,
self.replica_directory_id,
self.log_end_offset,
self.last_fetch_timestamp_ms,
self.last_caught_up_timestamp_ms,
)
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DescribeMetadataQuorumListener {
pub(super) name: String,
pub(super) host: String,
pub(super) port: u16,
}
impl DescribeMetadataQuorumListener {
pub fn name(&self) -> &str {
&self.name
}
pub fn host(&self) -> &str {
&self.host
}
pub const fn port(&self) -> u16 {
self.port
}
pub fn into_parts(self) -> (String, String, u16) {
(self.name, self.host, self.port)
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DescribeMetadataQuorumNode {
pub(super) node_id: i32,
pub(super) listeners: Vec<DescribeMetadataQuorumListener>,
}
impl DescribeMetadataQuorumNode {
pub const fn node_id(&self) -> i32 {
self.node_id
}
pub fn listeners(&self) -> &[DescribeMetadataQuorumListener] {
&self.listeners
}
pub fn into_parts(self) -> (i32, Vec<DescribeMetadataQuorumListener>) {
(self.node_id, self.listeners)
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DescribeMetadataQuorumDescription {
pub(super) leader_id: Option<i32>,
pub(super) leader_epoch: i32,
pub(super) high_watermark: i64,
pub(super) voters: Vec<DescribeMetadataQuorumReplica>,
pub(super) observers: Vec<DescribeMetadataQuorumReplica>,
pub(super) nodes: Option<Vec<DescribeMetadataQuorumNode>>,
}
impl DescribeMetadataQuorumDescription {
pub const fn leader_id(&self) -> Option<i32> {
self.leader_id
}
pub const fn leader_epoch(&self) -> i32 {
self.leader_epoch
}
pub const fn high_watermark(&self) -> i64 {
self.high_watermark
}
pub fn voters(&self) -> &[DescribeMetadataQuorumReplica] {
&self.voters
}
pub fn observers(&self) -> &[DescribeMetadataQuorumReplica] {
&self.observers
}
pub fn nodes(&self) -> Option<&[DescribeMetadataQuorumNode]> {
self.nodes.as_deref()
}
#[allow(clippy::type_complexity)]
pub fn into_parts(
self,
) -> (
Option<i32>,
i32,
i64,
Vec<DescribeMetadataQuorumReplica>,
Vec<DescribeMetadataQuorumReplica>,
Option<Vec<DescribeMetadataQuorumNode>>,
) {
(
self.leader_id,
self.leader_epoch,
self.high_watermark,
self.voters,
self.observers,
self.nodes,
)
}
}