Class: Mongo::Server::Description
- Inherits:
-
Object
- Object
- Mongo::Server::Description
- Defined in:
- build/ruby-driver-v2.17/lib/mongo/server/description.rb,
build/ruby-driver-v2.17/lib/mongo/server/description/features.rb,
build/ruby-driver-v2.17/lib/mongo/server/description/load_balancer.rb
Overview
Represents a description of the server, populated by the result of the hello command.
Note: Unknown servers do not have wire versions, but for legacy reasons we return 0 for min_wire_version and max_wire_version of any server that does not have them. Presently the driver sometimes constructs commands when the server is unknown, so references to min_wire_version and max_wire_version should not be nil. When driver behavior is changed (jira.mongodb.org/browse/RUBY-1805), this may no longer be necessary.
Defined Under Namespace
Classes: Features, LoadBalancer
Constant Summary collapse
- ARBITER =
Deprecated.
Constant for reading arbiter info from config.
'arbiterOnly'.freeze
- ARBITERS =
Constant for reading arbiters info from config.
'arbiters'.freeze
- HIDDEN =
Constant for reading hidden info from config.
'hidden'.freeze
- HOSTS =
Constant for reading hosts info from config.
'hosts'.freeze
- MESSAGE =
Deprecated.
Constant for the key for the message value.
'msg'.freeze
- MONGOS_MESSAGE =
Deprecated.
Constant for the message that indicates a sharded cluster.
'isdbgrid'.freeze
- REPLICA_SET =
Deprecated.
Constant for determining ghost servers.
'isreplicaset'.freeze
- MAX_BSON_OBJECT_SIZE =
Constant for reading max bson size info from config.
'maxBsonObjectSize'.freeze
- MAX_MESSAGE_BYTES =
Constant for reading max message size info from config.
'maxMessageSizeBytes'.freeze
- MAX_WIRE_VERSION =
Constant for the max wire version.
'maxWireVersion'.freeze
- MIN_WIRE_VERSION =
Constant for min wire version.
'minWireVersion'.freeze
- MAX_WRITE_BATCH_SIZE =
Constant for reading max write batch size.
'maxWriteBatchSize'.freeze
- LAST_WRITE =
Constant for the lastWrite subdocument.
'lastWrite'.freeze
- LAST_WRITE_DATE =
Constant for the lastWriteDate field in the lastWrite subdocument.
'lastWriteDate'.freeze
- ME =
Constant for reading the me field.
'me'.freeze
- DEFAULT_MAX_WRITE_BATCH_SIZE =
Default max write batch size.
1000.freeze
- LEGACY_WIRE_VERSION =
Deprecated.
Will be removed in 3.0.
The legacy wire protocol version.
0.freeze
- PASSIVE =
Constant for reading passive info from config.
'passive'.freeze
- PASSIVES =
Constant for reading the passive server list.
'passives'.freeze
- PRIMARY =
Deprecated.
Constant for reading primary info from config.
'ismaster'.freeze
- PRIMARY_HOST =
Constant for reading primary host field from config.
'primary'.freeze
- SECONDARY =
Deprecated.
Constant for reading secondary info from config.
'secondary'.freeze
- SET_NAME =
Constant for reading replica set name info from config.
'setName'.freeze
- TAGS =
Constant for reading tags info from config.
'tags'.freeze
- ELECTION_ID =
Constant for reading electionId info from config.
'electionId'.freeze
- SET_VERSION =
Constant for reading setVersion info from config.
'setVersion'.freeze
- LOCAL_TIME =
Constant for reading localTime info from config.
'localTime'.freeze
- OPERATION_TIME =
Constant for reading operationTime info from config.
'operationTime'.freeze
- LOGICAL_SESSION_TIMEOUT_MINUTES =
Constant for reading logicalSessionTimeoutMinutes info from config.
'logicalSessionTimeoutMinutes'.freeze
- CONNECTION_ID =
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.
Constant for reading connectionId info from config.
'connectionId'.freeze
- EXCLUDE_FOR_COMPARISON =
Fields to exclude when comparing two descriptions.
[ LOCAL_TIME, LAST_WRITE, OPERATION_TIME, Operation::CLUSTER_TIME, CONNECTION_ID, ].freeze
Instance Attribute Summary collapse
-
#address ⇒ Address
readonly
Address The server’s address.
-
#average_round_trip_time ⇒ Float
readonly
The moving average time the hello call took to complete.
-
#config ⇒ Hash
readonly
The actual result from the hello command.
-
#last_update_monotime ⇒ Float
readonly
private
Time when this server description was created according to monotonic clock.
-
#last_update_time ⇒ Time
readonly
Time when this server description was created.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
(also: #eql?)
Check equality of two descriptions.
-
#arbiter? ⇒ true, false
Returns whether this server is an arbiter, per the SDAM spec.
-
#arbiters ⇒ Array<String>
Get a list of all arbiters in the replica set.
-
#data_bearing? ⇒ true, false
Whether this description is from a data-bearing server (standalone, mongos, primary or secondary).
-
#election_id ⇒ BSON::ObjectId
Get the electionId from the config.
-
#features ⇒ Features
Features The features for the server.
-
#ghost? ⇒ true, false
Whether this server is a ghost, per the SDAM spec.
-
#hidden? ⇒ true, false
Will return true if the server is hidden.
-
#hosts ⇒ Array<String>
Get a list of all servers in the replica set.
-
#initialize(address, config = {}, average_round_trip_time: nil, load_balancer: false, force_load_balancer: false) ⇒ Description
constructor
private
Instantiate the new server description from the result of the hello command or fabricate a placeholder description for Unknown and LoadBalancer servers.
-
#inspect ⇒ String
Inspect the server description.
- #is_server?(server) ⇒ true, false deprecated Deprecated.
-
#last_write_date ⇒ Time
Get the lastWriteDate from the lastWrite subdocument in the config.
- #lists_server?(server) ⇒ true, false deprecated Deprecated.
-
#load_balancer? ⇒ true | false
Returns whether this server is a load balancer.
-
#logical_session_timeout ⇒ Integer?
Get the logicalSessionTimeoutMinutes from the config.
-
#max_bson_object_size ⇒ Integer
Get the max BSON object size for this server version.
-
#max_message_size ⇒ Integer
Get the max message size for this server version.
-
#max_wire_version ⇒ Integer
Get the maximum wire version.
-
#max_write_batch_size ⇒ Integer
Get the maximum batch size for writes.
-
#me ⇒ String
Get the me field value.
-
#me_mismatch? ⇒ true, false
Check if there is a mismatch between the address host and the me field.
-
#min_wire_version ⇒ Integer
Get the minimum wire version.
-
#mongos? ⇒ true, false
Returns whether this server is a mongos, per the SDAM spec.
- #ok? ⇒ Boolean private
-
#op_time ⇒ BSON::Timestamp
opTime in lastWrite subdocument of the hello response.
-
#other? ⇒ true, false
Returns whether the server is an other, per the SDAM spec.
-
#passive? ⇒ true, false
Will return true if the server is passive.
-
#passives ⇒ Array<String>
Get a list of the passive servers in the cluster.
-
#primary? ⇒ true, false
Returns whether this server is a primary, per the SDAM spec.
-
#primary_host ⇒ String | nil
Get the address of the primary host.
-
#replica_set_member? ⇒ true, false
Does this description correspond to a replica set member.
-
#replica_set_name ⇒ String?
Get the name of the replica set the server belongs to, returns nil if none.
-
#secondary? ⇒ true, false
Returns whether this server is a secondary, per the SDAM spec.
- #server_connection_id ⇒ Object
-
#server_type ⇒ Symbol
Returns the server type as a symbol.
- #server_version_gte?(version) ⇒ Boolean private
-
#servers ⇒ Array<String>
Get a list of all servers known to the cluster.
- #service_id ⇒ Object
-
#set_version ⇒ Integer
Get the setVersion from the config.
-
#standalone? ⇒ true, false
Returns whether this server is a standalone, per the SDAM spec.
-
#tags ⇒ Hash
Get the tags configured for the server.
-
#topology_version ⇒ TopologyVersion | nil
The topology version.
-
#topology_version_gt?(other_desc) ⇒ true | false
private
Returns whether topology version in this description is potentially newer than or equal to topology version in another description.
-
#topology_version_gte?(other_desc) ⇒ true | false
private
Returns whether topology version in this description is potentially newer than topology version in another description.
-
#unknown? ⇒ true, false
Returns whether this server is an unknown, per the SDAM spec.
-
#wire_versions ⇒ Range
Get the range of supported wire versions for the server.
Constructor Details
#initialize(address, config = {}, average_round_trip_time: nil, load_balancer: false, force_load_balancer: false) ⇒ Description
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.
Instantiate the new server description from the result of the hello command or fabricate a placeholder description for Unknown and LoadBalancer servers.
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 220 def initialize(address, config = {}, average_round_trip_time: nil, load_balancer: false, force_load_balancer: false ) @address = address @config = config @load_balancer = !!load_balancer @force_load_balancer = !!force_load_balancer @features = Features.new(wire_versions, me || @address.to_s) @average_round_trip_time = average_round_trip_time @last_update_time = Time.now.freeze @last_update_monotime = Utils.monotonic_time if load_balancer # When loadBalanced=true URI option is set, the driver will refuse # to work if the server it communicates with does not set serviceId # in ismaster/hello response. # # In practice, there are currently no server version that actually # sets this field. # # Therefore, when connect=:load_balanced Ruby option is used instead # of the loadBalanced=true URI option, if serviceId is not set in # ismaster/hello response, the driver fabricates a serviceId and # proceeds to treat a server that does not report itself as being # behind a load balancer as a server that is behind a load balancer. # # 5.0+ servers should provide topologyVersion.processId which # is specific to the particular process instance. We can use that # field as a proxy for serviceId. # # If the topologyVersion isn't provided for whatever reason, we # fabricate a serviceId locally. # # In either case, a serviceId provided by an actual server behind # a load balancer is supposed to be a BSON::ObjectId. The fabricated # service ids are strings, to distinguish them from the real ones. # In particular processId is also a BSON::ObjectId, but will be # mapped to a string for clarity that this is a fake service id. if ok? && !service_id unless force_load_balancer raise Error::MissingServiceId, "The server at #{address.seed} did not provide a service id in handshake response" end fake_service_id = if process_id = topology_version && topology_version['processId'] "process:#{process_id}" else "fake:#{rand(2**32-1)+1}" end @config = @config.merge('serviceId' => fake_service_id) end end if Mongo::Lint.enabled? # prepopulate cache instance variables hosts arbiters passives topology_version freeze end end |
Instance Attribute Details
#address ⇒ Address (readonly)
Returns address The server’s address.
284 285 286 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 284 def address @address end |
#average_round_trip_time ⇒ Float (readonly)
Returns The moving average time the hello call took to complete.
307 308 309 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 307 def average_round_trip_time @average_round_trip_time end |
#config ⇒ Hash (readonly)
Returns The actual result from the hello command.
287 288 289 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 287 def config @config end |
#last_update_monotime ⇒ Float (readonly)
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.
Time when this server description was created according to monotonic clock.
839 840 841 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 839 def last_update_monotime @last_update_monotime end |
#last_update_time ⇒ Time (readonly)
This time does not indicate when a successful server check
Time when this server description was created.
completed, because marking a server unknown updates its description and last_update_time. Use Server#last_scan to find out when the server was last successfully checked by its Monitor.
830 831 832 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 830 def last_update_time @last_update_time end |
Instance Method Details
#==(other) ⇒ true, false Also known as: eql?
Check equality of two descriptions.
861 862 863 864 865 866 867 868 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 861 def ==(other) return false if self.class != other.class return false if unknown? || other.unknown? (config.keys + other.config.keys).uniq.all? do |k| config[k] == other.config[k] || EXCLUDE_FOR_COMPARISON.include?(k) end end |
#arbiter? ⇒ true, false
Returns whether this server is an arbiter, per the SDAM spec.
317 318 319 320 321 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 317 def arbiter? ok? && config['arbiterOnly'] == true && !!config['setName'] end |
#arbiters ⇒ Array<String>
Get a list of all arbiters in the replica set.
331 332 333 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 331 def arbiters @arbiters ||= (config[ARBITERS] || []).map { |s| s.downcase } end |
#data_bearing? ⇒ true, false
Whether this description is from a data-bearing server (standalone, mongos, primary or secondary).
793 794 795 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 793 def data_bearing? mongos? || primary? || secondary? || standalone? end |
#election_id ⇒ BSON::ObjectId
Get the electionId from the config.
479 480 481 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 479 def election_id config[ELECTION_ID] end |
#features ⇒ Features
Returns features The features for the server.
297 298 299 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 297 def features @features end |
#ghost? ⇒ true, false
Whether this server is a ghost, per the SDAM spec.
343 344 345 346 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 343 def ghost? ok? && config['isreplicaset'] == true end |
#hidden? ⇒ true, false
Will return true if the server is hidden.
356 357 358 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 356 def hidden? ok? && !!config[HIDDEN] end |
#hosts ⇒ Array<String>
Get a list of all servers in the replica set.
368 369 370 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 368 def hosts @hosts ||= (config[HOSTS] || []).map { |s| s.downcase } end |
#inspect ⇒ String
Inspect the server description.
380 381 382 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 380 def inspect "#<Mongo::Server:Description:0x#{object_id} config=#{config} average_round_trip_time=#{average_round_trip_time}>" end |
#is_server?(server) ⇒ true, false
Is this description from the given server.
755 756 757 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 755 def is_server?(server) address == server.address end |
#last_write_date ⇒ Time
Get the lastWriteDate from the lastWrite subdocument in the config.
544 545 546 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 544 def last_write_date config[LAST_WRITE][LAST_WRITE_DATE] if config[LAST_WRITE] end |
#lists_server?(server) ⇒ true, false
Is a server included in this description’s list of servers.
769 770 771 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 769 def lists_server?(server) servers.include?(server.address.to_s) end |
#load_balancer? ⇒ true | false
Returns whether this server is a load balancer.
292 293 294 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 292 def load_balancer? @load_balancer end |
#logical_session_timeout ⇒ Integer?
Get the logicalSessionTimeoutMinutes from the config.
556 557 558 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 556 def logical_session_timeout config[LOGICAL_SESSION_TIMEOUT_MINUTES] if config[LOGICAL_SESSION_TIMEOUT_MINUTES] end |
#max_bson_object_size ⇒ Integer
Get the max BSON object size for this server version.
392 393 394 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 392 def max_bson_object_size config[MAX_BSON_OBJECT_SIZE] end |
#max_message_size ⇒ Integer
Get the max message size for this server version.
404 405 406 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 404 def config[MAX_MESSAGE_BYTES] end |
#max_wire_version ⇒ Integer
Get the maximum wire version. Defaults to zero.
428 429 430 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 428 def max_wire_version config[MAX_WIRE_VERSION] || 0 end |
#max_write_batch_size ⇒ Integer
Get the maximum batch size for writes.
416 417 418 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 416 def max_write_batch_size config[MAX_WRITE_BATCH_SIZE] || DEFAULT_MAX_WRITE_BATCH_SIZE end |
#me ⇒ String
The value in me field may differ from the server description’s address. This can happen, for example, in split horizon configurations. The SDAM spec only requires removing servers whose me does not match their address in some of the situations (e.g. when the server in question is an RS member but not a primary).
Get the me field value.
455 456 457 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 455 def me config[ME] end |
#me_mismatch? ⇒ true, false
Check if there is a mismatch between the address host and the me field.
805 806 807 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 805 def me_mismatch? !!(address.to_s.downcase != me.downcase if me) end |
#min_wire_version ⇒ Integer
Get the minimum wire version. Defaults to zero.
440 441 442 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 440 def min_wire_version config[MIN_WIRE_VERSION] || 0 end |
#mongos? ⇒ true, false
Returns whether this server is a mongos, per the SDAM spec.
568 569 570 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 568 def mongos? ok? && config['msg'] == 'isdbgrid' end |
#ok? ⇒ Boolean
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.
729 730 731 732 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 729 def ok? config[Operation::Result::OK] && config[Operation::Result::OK] == 1 || false end |
#op_time ⇒ BSON::Timestamp
opTime in lastWrite subdocument of the hello response.
814 815 816 817 818 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 814 def op_time if config['lastWrite'] && config['lastWrite']['opTime'] config['lastWrite']['opTime']['ts'] end end |
#other? ⇒ true, false
Returns whether the server is an other, per the SDAM spec.
580 581 582 583 584 585 586 587 588 589 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 580 def other? # The SDAM spec is slightly confusing on what "other" means, # but it's referred to it as "RSOther" which means a non-RS member # cannot be "other". ok? && !!config['setName'] && ( config['hidden'] == true || !primary? && !secondary? && !arbiter? ) end |
#passive? ⇒ true, false
Will return true if the server is passive.
599 600 601 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 599 def passive? ok? && !!config[PASSIVE] end |
#passives ⇒ Array<String>
Get a list of the passive servers in the cluster.
611 612 613 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 611 def passives @passives ||= (config[PASSIVES] || []).map { |s| s.downcase } end |
#primary? ⇒ true, false
Returns whether this server is a primary, per the SDAM spec.
635 636 637 638 639 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 635 def primary? ok? && (config['ismaster'] == true || config['isWritablePrimary'] == true ) && !!config['setName'] end |
#primary_host ⇒ String | nil
Get the address of the primary host.
623 624 625 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 623 def primary_host config[PRIMARY_HOST] && config[PRIMARY_HOST].downcase end |
#replica_set_member? ⇒ true, false
Does this description correspond to a replica set member.
782 783 784 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 782 def replica_set_member? ok? && !(standalone? || mongos?) end |
#replica_set_name ⇒ String?
Get the name of the replica set the server belongs to, returns nil if none.
650 651 652 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 650 def replica_set_name config[SET_NAME] end |
#secondary? ⇒ true, false
Returns whether this server is a secondary, per the SDAM spec.
674 675 676 677 678 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 674 def secondary? ok? && config['secondary'] == true && !!config['setName'] end |
#server_connection_id ⇒ Object
842 843 844 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 842 def server_connection_id config['connectionId'] end |
#server_type ⇒ Symbol
Returns the server type as a symbol.
688 689 690 691 692 693 694 695 696 697 698 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 688 def server_type return :load_balancer if load_balancer? return :arbiter if arbiter? return :ghost if ghost? return :sharded if mongos? return :primary if primary? return :secondary if secondary? return :standalone if standalone? return :other if other? :unknown end |
#server_version_gte?(version) ⇒ Boolean
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.
872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 872 def server_version_gte?(version) required_wv = case version when '5.0' 12 when '4.4' 9 when '4.2' 8 when '4.0' 7 when '3.6' 6 when '3.4' 5 when '3.2' 4 when '3.0' 3 when '2.6' 2 else raise ArgumentError, "Bogus required version #{version}" end if load_balancer? # If we are talking to a load balancer, there is no monitoring # and we don't know what server is behind the load balancer. # Assume everything is supported. # TODO remove this when RUBY-2220 is implemented. return true end required_wv >= min_wire_version && required_wv <= max_wire_version end |
#servers ⇒ Array<String>
Get a list of all servers known to the cluster.
662 663 664 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 662 def servers hosts + arbiters + passives end |
#service_id ⇒ Object
302 303 304 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 302 def service_id config['serviceId'] end |
#set_version ⇒ Integer
Get the setVersion from the config.
491 492 493 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 491 def set_version config[SET_VERSION] end |
#standalone? ⇒ true, false
Returns whether this server is a standalone, per the SDAM spec.
708 709 710 711 712 713 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 708 def standalone? ok? && config['msg'] != 'isdbgrid' && config['setName'].nil? && config['isreplicaset'] != true end |
#tags ⇒ Hash
Get the tags configured for the server.
467 468 469 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 467 def config[TAGS] || {} end |
#topology_version ⇒ TopologyVersion | nil
Returns The topology version.
496 497 498 499 500 501 502 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 496 def topology_version unless defined?(@topology_version) @topology_version = config['topologyVersion'] && TopologyVersion.new(config['topologyVersion']) end @topology_version end |
#topology_version_gt?(other_desc) ⇒ true | false
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 whether topology version in this description is potentially newer than or equal to topology version in another description.
512 513 514 515 516 517 518 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 512 def topology_version_gt?(other_desc) if topology_version.nil? || other_desc.topology_version.nil? true else topology_version.gt?(other_desc.topology_version) end end |
#topology_version_gte?(other_desc) ⇒ true | false
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 whether topology version in this description is potentially newer than topology version in another description.
528 529 530 531 532 533 534 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 528 def topology_version_gte?(other_desc) if topology_version.nil? || other_desc.topology_version.nil? true else topology_version.gte?(other_desc.topology_version) end end |
#unknown? ⇒ true, false
Returns whether this server is an unknown, per the SDAM spec.
723 724 725 726 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 723 def unknown? return false if load_balancer? config.empty? || config.keys == %w(topologyVersion) || !ok? end |
#wire_versions ⇒ Range
Get the range of supported wire versions for the server.
742 743 744 |
# File 'build/ruby-driver-v2.17/lib/mongo/server/description.rb', line 742 def wire_versions min_wire_version..max_wire_version end |