/// add new follower controller and it's mailbox
add new follower controller and it's mailbox
add new follower controller and it ' s mailbox
async fn add_follower_replica(&self,replica: Replica) {
        let leader = &replica.leader;
        debug!("trying to adding follower replica: {}",replica);
        if let Some(mut sender) = self.ctx.followers_state().mailbox(leader) {
            debug!("existing follower controller exists: {}, send request to controller",replica);
             log_on_err!(sender.send(FollowerReplicaControllerCommand::AddReplica(replica)).await)
        } else {
            // we need to spin new follower controller
             debug!("no existing follower controller exists for {},need to spin up",replica);
            let (mut sender,receiver) = self.ctx.followers_state().insert_mailbox(*leader);
            let follower_controller = ReplicaFollowerController::new(
                *leader,
                receiver,
                self.ctx.spu_localstore_owned(),
                self.ctx.followers_state_owned(),
                self.ctx.config_owned()
            );
            follower_controller.run();
            log_on_err!(sender.send(FollowerReplicaControllerCommand::AddReplica(replica)).await);
        }
    }
async fn add_follower_replica ( & self , replica : Replica ) { let leader = & replica . leader ; debug ! ( " " replica ) ; if let Some ( mut sender ) = self . ctx . followers_state ( ) . mailbox ( leader ) { debug ! ( " " replica ) ; log_on_err ! ( sender send ( FollowerReplicaControllerCommand AddReplica ( replica ) ) await ) } else { // we need to spin new follower controller debug ! ( " " replica ) ; let ( mut sender , receiver ) = self . ctx . followers_state ( ) . insert_mailbox ( * leader ) ; let follower_controller = ReplicaFollowerController :: new ( * leader , receiver , self . ctx . spu_localstore_owned ( ) , self . ctx . followers_state_owned ( ) , self . ctx . config_owned ( ) ) ; follower_controller . run ( ) ; log_on_err ! ( sender send ( FollowerReplicaControllerCommand AddReplica ( replica ) ) await ) ; } }
add new follower controller and it's mailbox
add new follower controller and it ' s mailbox
&self
replica
Replica