[][src]Struct mongodb_cwal::topology::TopologyDescription

pub struct TopologyDescription {
    pub topology_type: TopologyType,
    pub set_name: String,
    pub servers: HashMap<Host, Server>,
    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: TopologyTypeset_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<Host, Server>

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]

pub fn new(stream_connector: StreamConnector) -> TopologyDescription[src]

Returns a default, unknown topology description.

pub fn acquire_stream(
    &self,
    client: Client,
    read_preference: &ReadPreference
) -> Result<(PooledStream, bool, bool)>
[src]

Returns a server stream for read operations.

pub fn acquire_write_stream(&self, client: Client) -> Result<PooledStream>[src]

Returns a server stream for write operations.

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

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

pub fn filter_latency_hosts(&self, hosts: &mut Vec<Host>)[src]

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

pub fn choose_write_hosts(&self) -> (Vec<Host>, bool)[src]

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

pub fn choose_hosts(
    &self,
    read_preference: &ReadPreference
) -> Result<(Vec<Host>, bool)>
[src]

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

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

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

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

Updates the topology description based on an updated server description.

Trait Implementations

impl Clone for TopologyDescription[src]

impl Default for TopologyDescription[src]

impl Debug for TopologyDescription[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<T> Same<T> for T

type Output = T

Should always be Self