/// Update the topology using the given server description.
///
/// Because this method takes a lock guard as a parameter, it is mainly useful for sychronizing
/// updates to the topology with other state management.
///
/// Returns a boolean indicating whether the topology changed as a result of the update.
Update the topology using the given server description.
Because this method takes a lock guard as a parameter, it is mainly useful for sychronizing
updates to the topology with other state management.

Returns a boolean indicating whether the topology changed as a result of the update.
Update the topology using the given server description . Because this method takes a lock guard as a parameter it is mainly useful for sychronizing updates to the topology with other state management . Returns a boolean indicating whether the topology changed as a result of the update .
async fn update_and_notify(
        &self,
        server: &Server,
        server_description: ServerDescription,
        mut state_lock: RwLockWriteGuard<'_, TopologyState>,
    ) -> bool {
        let server_type = server_description.server_type;
        // TODO RUST-580: Theoretically, `TopologyDescription::update` can return an error. However,
        // this can only happen if we try to access a field from the isMaster response when an error
        // occurred during the check. In practice, this can't happen, because the SDAM algorithm
        // doesn't check the fields of an Unknown server, and we only return Unknown server
        // descriptions when errors occur. Once we implement logging, we can properly inform users
        // of errors that occur here.
        match state_lock.update(server_description, &self.common.options, self.downgrade()) {
            Ok(true) => {
                if server_type.is_data_bearing()
                    || (server_type != ServerType::Unknown
                        && state_lock.description.topology_type() == TopologyType::Single)
                {
                    server.pool.mark_as_ready().await;
                }
                true
            }
            _ => false,
        }
    }
async fn update_and_notify ( & self , server : & Server , server_description : ServerDescription , mut state_lock : RwLockWriteGuard < ' _ , TopologyState > , ) -> bool { let server_type = server_description . server_type ; // TODO RUST-580: Theoretically, `TopologyDescription::update` can return an error. However, // this can only happen if we try to access a field from the isMaster response when an error // occurred during the check. In practice, this can't happen, because the SDAM algorithm // doesn't check the fields of an Unknown server, and we only return Unknown server // descriptions when errors occur. Once we implement logging, we can properly inform users // of errors that occur here. match state_lock . update ( server_description , & self . common . options , self . downgrade ( ) ) { Ok ( true ) => { if server_type . is_data_bearing ( ) || ( server_type != ServerType :: Unknown && state_lock . description . topology_type ( ) == TopologyType :: Single ) { server . pool . mark_as_ready ( ) . await ; } true } _ => false , } }
Update the topology using the given server description.
Update the topology using the given server description .
&self
server
&Server
server_description
ServerDescription
state_lock
RwLockWriteGuard<'_, TopologyState>