pub struct BrokerReplicaInfo {
pub cluster_name: String,
pub broker_name: String,
pub broker_id: u64,
pub broker_addr: String,
pub role: ReplicaRole,
pub epoch: u64,
pub max_offset: i64,
pub last_sync_timestamp: u64,
pub in_sync: bool,
}Expand description
Broker replica information
Tracks the state of a broker replica including:
- Role (master/slave)
- Epoch (version number for master election)
- Sync state (whether replica is in-sync)
- Offset tracking
Fields§
§cluster_name: StringCluster name
broker_name: StringBroker name (identifies the broker set)
broker_id: u64Broker ID (0 for master, >0 for slaves)
broker_addr: StringBroker address
role: ReplicaRoleReplica role
epoch: u64Epoch number (incremented on master election)
max_offset: i64Maximum offset
last_sync_timestamp: u64Last sync timestamp
in_sync: boolWhether this replica is in-sync
Implementations§
Source§impl BrokerReplicaInfo
impl BrokerReplicaInfo
Sourcepub fn new_master(
cluster_name: String,
broker_name: String,
broker_id: u64,
broker_addr: String,
epoch: u64,
) -> Self
pub fn new_master( cluster_name: String, broker_name: String, broker_id: u64, broker_addr: String, epoch: u64, ) -> Self
Create a new master replica
Sourcepub fn new_slave(
cluster_name: String,
broker_name: String,
broker_id: u64,
broker_addr: String,
) -> Self
pub fn new_slave( cluster_name: String, broker_name: String, broker_id: u64, broker_addr: String, ) -> Self
Create a new slave replica
Sourcepub fn is_in_sync(&self) -> bool
pub fn is_in_sync(&self) -> bool
Check if this replica is in-sync
Sourcepub fn replica_id(&self) -> String
pub fn replica_id(&self) -> String
Get replica ID (broker_name:broker_id)
Trait Implementations§
Source§impl Clone for BrokerReplicaInfo
impl Clone for BrokerReplicaInfo
Source§fn clone(&self) -> BrokerReplicaInfo
fn clone(&self) -> BrokerReplicaInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BrokerReplicaInfo
impl Debug for BrokerReplicaInfo
Source§impl<'de> Deserialize<'de> for BrokerReplicaInfo
impl<'de> Deserialize<'de> for BrokerReplicaInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BrokerReplicaInfo
impl RefUnwindSafe for BrokerReplicaInfo
impl Send for BrokerReplicaInfo
impl Sync for BrokerReplicaInfo
impl Unpin for BrokerReplicaInfo
impl UnwindSafe for BrokerReplicaInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more