/// Update the ReplicaSetNoPrimary topology description based on the server description.
Update the ReplicaSetNoPrimary topology description based on the server description.
Update the ReplicaSetNoPrimary topology description based on the server description .
fn update_replica_set_no_primary_topology(
        &mut self,
        server_description: ServerDescription,
    ) -> Result<(), String> {
        match server_description.server_type {
            ServerType::Unknown | ServerType::RsGhost => {}
            ServerType::Standalone | ServerType::Mongos => {
                self.servers.remove(&server_description.address);
            }
            ServerType::RsPrimary => {
                self.topology_type = TopologyType::ReplicaSetWithPrimary;
                self.update_rs_from_primary_server(server_description)?
            }
            ServerType::RsSecondary | ServerType::RsArbiter | ServerType::RsOther => {
                self.update_rs_without_primary_server(server_description)?;
            }
            ServerType::LoadBalancer => {
                return Err("cannot transition to a load balancer".to_string())
            }
        }
        Ok(())
    }
fn update_replica_set_no_primary_topology ( & mut self , server_description : ServerDescription , ) -> Result < ( ) , String > { match server_description . server_type { ServerType :: Unknown | ServerType :: RsGhost => { } ServerType :: Standalone | ServerType :: Mongos => { self . servers . remove ( & server_description . address ) ; } ServerType :: RsPrimary => { self . topology_type = TopologyType :: ReplicaSetWithPrimary ; self . update_rs_from_primary_server ( server_description ) ? } ServerType :: RsSecondary | ServerType :: RsArbiter | ServerType :: RsOther => { self . update_rs_without_primary_server ( server_description ) ? ; } ServerType :: LoadBalancer => { return Err ( " " . to_string ( ) ) } } Ok ( ( ) ) }
Update the ReplicaSetNoPrimary topology description based on the server description.
Update the ReplicaSetNoPrimary topology description based on the server description .
&mut self
server_description
ServerDescription