vibe.db.mongo.topology

MongoDB topology description and server selection.

Implements server selection logic for replica sets based on the MongoDB Server Selection specification.

See Also

Types 3

Tracks the known state of all servers in a deployment.

Updated after each successful handshake. Used by server selection to pick an appropriate host for a given read preference.

unknown
single
replicaSetWithPrimary
replicaSetNoPrimary
sharded
Fields
ServerRecord[] servers
string setName
uint seedCount
Nullable!BsonObjectID maxElectionId
Nullable!int maxSetVersion
Methods
Nullable!MongoHost randomMongosHost(long localThresholdMS = 15) const
Nullable!MongoHost randomSecondaryHost(long maxStalenessSeconds = - 1) const
MongoHost[] secondaryHosts(long maxStalenessSeconds = - 1) const
Nullable!MongoHost randomHostWithinLatencyWindow(long localThresholdMS, long maxStalenessSeconds = - 1) const
Fields
ServerDescription description

Functions 1

fnNullable!MongoHost selectServer(ref const TopologyDescription topology, ReadPreference pref, long localThresholdMS = 15, long maxStalenessSeconds = - 1) @safeSelects a server from the topology based on the given read preference.