Class: Mongo::ServerSelector::PrimaryPreferred
- Defined in:
- lib/mongo/server_selector/primary_preferred.rb
Overview
Encapsulates specifications for selecting servers, with the
primary preferred, given a list of candidates.
Constant Summary collapse
- SERVER_FORMATTED_NAME =
Name of the this read preference in the server’s format.
'primaryPreferred'
Instance Attribute Summary
Attributes inherited from Base
#hedge, #max_staleness, #options, #tag_sets
Instance Method Summary collapse
-
#hedge_allowed? ⇒ true
Whether the hedge option is allowed to be defined for this server preference.
-
#name ⇒ Symbol
Get the name of the server mode type.
-
#secondary_ok? ⇒ true
private
Whether the secondaryOk bit should be set on wire protocol messages.
-
#tags_allowed? ⇒ true
Whether tag sets are allowed to be defined for this server preference.
-
#to_doc ⇒ Hash
(also: #to_mongos)
Convert this server preference definition into a format appropriate for sending to a MongoDB server (i.e., as a command field).
Methods inherited from Base
#==, #candidates, #initialize, #inspect, #local_threshold, #local_threshold_with_cluster, #select_server, #server_selection_timeout, #suitable_servers, #try_select_server
Constructor Details
This class inherits a constructor from Mongo::ServerSelector::Base
Instance Method Details
#hedge_allowed? ⇒ true
Whether the hedge option is allowed to be defined for this server preference.
62 63 64 |
# File 'lib/mongo/server_selector/primary_preferred.rb', line 62 def hedge_allowed? true end |
#name ⇒ Symbol
Get the name of the server mode type.
37 38 39 |
# File 'lib/mongo/server_selector/primary_preferred.rb', line 37 def name :primary_preferred end |
#secondary_ok? ⇒ true
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.
Whether the secondaryOk bit should be set on wire protocol messages.
I.e. whether the operation can be performed on a secondary server.
46 47 48 |
# File 'lib/mongo/server_selector/primary_preferred.rb', line 46 def secondary_ok? true end |
#tags_allowed? ⇒ true
Whether tag sets are allowed to be defined for this server preference.
55 56 57 |
# File 'lib/mongo/server_selector/primary_preferred.rb', line 55 def true end |
#to_doc ⇒ Hash Also known as: to_mongos
Convert this server preference definition into a format appropriate
for sending to a MongoDB server (i.e., as a command field).
72 73 74 |
# File 'lib/mongo/server_selector/primary_preferred.rb', line 72 def to_doc full_doc end |