mongodb-driver v0.6.3 Mongo.Monitor View Source
Each server has a monitor process. The monitor process is created by the topology process.
If the network connection is working, then the monitor process reports this and the topology process starts the connection pool. Per server we get 1 + pool size connections to each server.
After waiting for heartbeat_frequency_ms
milliseconds, the monitor process calls isMaster
command and
reports the result to the topology process.
The result of the isMaster
command is mapped the ServerDescription
structure and sent to the topology process, which
updates it internal data structure.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Report the connection event, so the topology process can now create the connection pool.
Try to update the server description.
Time to update the topology. Calling isMaster
and updating the server description
The :timeout
call is the periodic call defined by the heartbeat frequency
The ':update' call updates the server description for the topology process
Initialize the monitor process
Stop the monitor process.
In this case we stop the DBConnection.
Link to this section Functions
child_spec(init_arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor
.
connected(connection, me, topology_pid) View Source
Report the connection event, so the topology process can now create the connection pool.
force_check(pid) View Source
Try to update the server description.
handle_cast(msg, state) View Source
Time to update the topology. Calling isMaster
and updating the server description
handle_info(msg, state) View Source
The :timeout
call is the periodic call defined by the heartbeat frequency
The ':update' call updates the server description for the topology process
init(list) View Source
Initialize the monitor process
start_link(args) View Source
stop(pid) View Source
Stop the monitor process.
We need to stop asynchronously because a Monitor can call the Topology which may try to stop the same Monitor that called it. Ending in a timeout.
terminate(reason, state) View Source
In this case we stop the DBConnection.