Struct mongodb::topology::TopologyDescription [] [src]

pub struct TopologyDescription {
    pub topology_type: TopologyType,
    pub set_name: String,
    pub servers: HashMap<HostServer>,
    pub heartbeat_frequency_ms: u32,
    pub local_threshold_ms: i64,
    pub server_selection_timeout_ms: i64,
    // some fields omitted
}

Topology information gathered from server set monitoring.

Fields

topology_type: TopologyType set_name: String

The set name for a replica set topology. If the topology is not a replica set, this will be an empty string.

servers: HashMap<HostServer>

Known servers within the topology.

heartbeat_frequency_ms: u32

The server connection health check frequency. The default is 10 seconds.

local_threshold_ms: i64

The size of the latency window for selecting suitable servers. The default is 15 milliseconds.

server_selection_timeout_ms: i64

This defines how long to block for server selection before returning an error. The default is 30 seconds.

Methods

impl TopologyDescription
[src]

fn new() -> TopologyDescription

Returns a default, unknown topology description.

fn acquire_stream(&self, read_preference: &ReadPreference) -> Result<(PooledStream, bool, bool)>

Returns a server stream for read operations.

fn acquire_write_stream(&self) -> Result<PooledStream>

Returns a server stream for write operations.

fn filter_hosts(&self, hosts: &mut Vec<Host>, read_preference: &ReadPreference)

Filters a given set of hosts based on the provided read preference tag sets.

fn filter_latency_hosts(&self, hosts: &mut Vec<Host>)

Filter out provided hosts by creating a latency window around the server with the lowest round-trip time.

fn choose_write_hosts(&self) -> (Vec<Host>, bool)

Returns suitable servers for write operations and whether to take a random element.

fn choose_hosts(&self, read_preference: &ReadPreference) -> (Vec<Host>, bool)

Returns suitable servers for read operations and whether to take a random element.

fn update_without_monitor(&mut self, host: Host, description: ServerDescription, client: Client, top_arc: Arc<RwLock<TopologyDescription>>)

Update the topology description, but don't start any monitors for new servers.

fn update(&mut self, host: Host, description: ServerDescription, client: Client, top_arc: Arc<RwLock<TopologyDescription>>)

Updates the topology description based on an updated server description.

Trait Implementations

impl Clone for TopologyDescription
[src]

fn clone(&self) -> TopologyDescription

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more