Monitor — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::Srv::MonitorPrivate

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Periodically retrieves SRV records for the cluster’s SRV URI, and sets the cluster’s server list to the SRV lookup result.

If an error is encountered during SRV lookup or an SRV record is invalid or disallowed for security reasons, a warning is logged and monitoring continues.

Constant Summarycollapse

MIN_SCAN_INTERVAL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

60

DEFAULT_TIMEOUT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

10

Constants included from Loggable

Loggable::PREFIX

Instance Attribute Summary collapse

Instance Method Summarycollapse

Methods included from BackgroundThread

#run!, #running?, #stop!

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger

Constructor Details

#initialize(cluster, **opts) ⇒ Monitor

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates the SRV monitor.

45 46 47 48 49 50 51 52 53 54 # File 'lib/mongo/srv/monitor.rb', line 45 def initialize(cluster, **opts) @cluster = cluster unless @srv_uri = opts.delete(:srv_uri) raise ArgumentError, 'SRV URI is required' end @options = opts.freeze @resolver = Srv::Resolver.new(**opts) @last_result = @srv_uri.srv_result @stop_semaphore = Semaphore.new end

Instance Attribute Details

#cluster ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

58 59 60 # File 'lib/mongo/srv/monitor.rb', line 58 def cluster @cluster end

#last_resultSrv::Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Last known SRV lookup result. Used for determining intervals between SRV lookups, which depend on SRV DNS records’ TTL values.

63 64 65 # File 'lib/mongo/srv/monitor.rb', line 63 def last_result @last_result end

#options ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

56 57 58 # File 'lib/mongo/srv/monitor.rb', line 56 def options @options end