| Class | Mongo::Cluster::SdamFlow |
| In: |
lib/mongo/cluster/sdam_flow.rb
|
| Parent: | Object |
Handles SDAM flow for a server description changed event.
Updates server descriptions, topology descriptions and publishes SDAM events.
SdamFlow is meant to be instantiated once for every server description changed event that needs to be processed.
@api private
| cluster | [R] | |
| previous_desc | [R] | |
| topology | [R] |
The topology stored in this attribute can change multiple times throughout
a single sdam flow (e.g. unknown -> RS no primary -> RS with
primary). Events for topology change get sent at the end of flow
processing, such that the above example only publishes an unknown -> RS
with primary event to the application.
@return Mongo::Cluster::Topology The current topology. |
| updated_desc | [R] |
Adds all servers referenced in the given description (which is supposed to have come from a good primary) which are not already in the cluster, to the cluster.
@note Servers are added unmonitored. Monitoring must be started later separately.
@return [ Array<Server> ] Servers actually added to the cluster.
This is the set of servers on which monitoring should be started.
Checks if the cluster has a primary, and if not, transitions the topology to ReplicaSetNoPrimary. Topology must be ReplicaSetWithPrimary when invoking this method.
Publishes server description changed events, updates topology on the cluster and publishes topology changed event, as needed based on operations performed during SDAM flow processing.
Removes specified server from topology and warns if the topology ends up with an empty server list as a result
Removes servers from the topology which are not present in the given server description (which is supposed to have come from a good primary).
Updates topology which must be a ReplicaSetWithPrimary with information from the primary‘s server description.
This method does not change topology type to ReplicaSetWithPrimary - this needs to have been done prior to calling this method.
If the primary whose description is being processed is determined to be stale, this method will change the server description and topology type to unknown.