pub fn remove_replica(&self, key: &ReplicaKey) -> Option<LeaderReplicaState<S>> {
        if let Some(replica) = self.replicas.remove(key) {
            if let Some(mut mailbox) = self.mailboxes.write().remove(key) {
                debug!("closing old leader mailbox: {}", key);
                mailbox.close_channel();
            } else {
                error!("no mailbox found for removing: {}", key);
            }
            Some(replica)
        } else {
            error!("leader replica: {} is not founded", key);
            None
        }
    }
/// remove leader replica
/// we also remove mailbox and close it's channel which will terminated the controller
remove leader replica
we also remove mailbox and close it's channel which will terminated the controller
remove leader replica we also remove mailbox and close it ' s channel which will terminated the controller
pub fn remove_replica(&self, key: &ReplicaKey) -> Option<LeaderReplicaState<S>> {
        if let Some(replica) = self.replicas.remove(key) {
            if let Some(mut mailbox) = self.mailboxes.write().remove(key) {
                debug!("closing old leader mailbox: {}", key);
                mailbox.close_channel();
            } else {
                error!("no mailbox found for removing: {}", key);
            }
            Some(replica)
        } else {
            error!("leader replica: {} is not founded", key);
            None
        }
    }
pub fn remove_replica ( & self , key : & ReplicaKey ) -> Option < LeaderReplicaState < S > > { if let Some ( replica ) = self . replicas . remove ( key ) { if let Some ( mut mailbox ) = self . mailboxes . write ( ) . remove ( key ) { debug ! ( " " key ) ; mailbox . close_channel ( ) ; } else { error ! ( " " key ) ; } Some ( replica ) } else { error ! ( " " key ) ; None } }
remove leader replica
we also remove mailbox and close it's channel which will terminated the controller
remove leader replica we also remove mailbox and close it ' s channel which will terminated the controller
&self
key
&ReplicaKey
&self
key
&ReplicaKey