pub struct ReplicasManager { /* private fields */ }Expand description
Replicas manager
Manages broker replicas and sync state sets across the cluster. Provides functionality for:
- Replica registration and tracking
- ISR (In-Sync Replicas) management
- Master election and failover
Implementations§
Source§impl ReplicasManager
impl ReplicasManager
Sourcepub fn new(config: Arc<ControllerConfig>) -> Self
pub fn new(config: Arc<ControllerConfig>) -> Self
Create a new replicas manager
Sourcepub async fn register_replica(&self, replica: BrokerReplicaInfo) -> Result<()>
pub async fn register_replica(&self, replica: BrokerReplicaInfo) -> Result<()>
Register a replica
Sourcepub async fn unregister_replica(
&self,
broker_name: &str,
broker_id: u64,
) -> Result<()>
pub async fn unregister_replica( &self, broker_name: &str, broker_id: u64, ) -> Result<()>
Unregister a replica
Sourcepub async fn get_master(&self, broker_name: &str) -> Option<BrokerReplicaInfo>
pub async fn get_master(&self, broker_name: &str) -> Option<BrokerReplicaInfo>
Get the master replica for a broker set
Sourcepub async fn get_replicas(&self, broker_name: &str) -> Vec<BrokerReplicaInfo>
pub async fn get_replicas(&self, broker_name: &str) -> Vec<BrokerReplicaInfo>
Get all replicas for a broker set
Sourcepub async fn get_replica(
&self,
broker_name: &str,
broker_id: u64,
) -> Option<BrokerReplicaInfo>
pub async fn get_replica( &self, broker_name: &str, broker_id: u64, ) -> Option<BrokerReplicaInfo>
Get a specific replica
Sourcepub async fn get_sync_state_set(
&self,
broker_name: &str,
) -> Option<SyncStateSet>
pub async fn get_sync_state_set( &self, broker_name: &str, ) -> Option<SyncStateSet>
Get sync state set for a broker set
Sourcepub async fn add_to_sync_state_set(
&self,
broker_name: &str,
broker_id: u64,
) -> Result<()>
pub async fn add_to_sync_state_set( &self, broker_name: &str, broker_id: u64, ) -> Result<()>
Add a broker to the sync state set
Sourcepub async fn remove_from_sync_state_set(
&self,
broker_name: &str,
broker_id: u64,
) -> Result<()>
pub async fn remove_from_sync_state_set( &self, broker_name: &str, broker_id: u64, ) -> Result<()>
Remove a broker from the sync state set
Sourcepub async fn update_sync_state_set(
&self,
broker_name: &str,
new_sync_state_set: Vec<u64>,
) -> Result<()>
pub async fn update_sync_state_set( &self, broker_name: &str, new_sync_state_set: Vec<u64>, ) -> Result<()>
Update sync state set
Sourcepub async fn elect_master(
&self,
broker_name: &str,
) -> Result<Option<BrokerReplicaInfo>>
pub async fn elect_master( &self, broker_name: &str, ) -> Result<Option<BrokerReplicaInfo>>
Elect a new master for a broker set
This is typically called when the current master fails. A new master is elected from the in-sync replicas.
Sourcepub async fn list_broker_sets(&self) -> Vec<String>
pub async fn list_broker_sets(&self) -> Vec<String>
List all broker sets
Auto Trait Implementations§
impl Freeze for ReplicasManager
impl !RefUnwindSafe for ReplicasManager
impl Send for ReplicasManager
impl Sync for ReplicasManager
impl Unpin for ReplicasManager
impl !UnwindSafe for ReplicasManager
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