Module: Mongo::Error::SdamErrorDetection
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/mongo/error/sdam_error_detection.rb |
Overview
Note:
Although not_master? and node_recovering? methods of this module are part of the public API, the fact that these methods are defined on this module and not on the classes which include this module is not part of the public API.
Constant Summary
-
NODE_RECOVERING_CODES =
Internal use only
[11600, 11602, 13436, 189, 91, 10058].freeze
-
NODE_SHUTTING_DOWN_CODES =
Internal use only
[11600, 91].freeze
-
NOT_MASTER_CODES =
Internal use only
[10107, 13435].freeze
Instance Attribute Summary
-
#node_recovering? ⇒ true | false
readonly
Whether the error is a “node is recovering” error, or one of its variants.
-
#node_shutting_down? ⇒ true | false
readonly
Whether the error is a “node is shutting down” type error.
-
#not_master? ⇒ true | false
readonly
Whether the error is a “not master” error, or one of its variants.
Instance Attribute Details
#node_recovering? ⇒ true
| false
(readonly)
Whether the error is a “node is recovering” error, or one of its variants.
# File 'lib/mongo/error/sdam_error_detection.rb', line 53
def node_recovering? # Require the error to be communicated at the top level of the response # for it to influence SDAM state. See DRIVERS-1376 / RUBY-2516. return false if document && document['ok'] == 1 if code NODE_RECOVERING_CODES.include?(code) elsif .include?('node is recovering') || .include?('not master or secondary') else false end end
#node_shutting_down? ⇒ true
| false
(readonly)
Whether the error is a “node is shutting down” type error.
# File 'lib/mongo/error/sdam_error_detection.rb', line 74
def node_shutting_down? if code && NODE_SHUTTING_DOWN_CODES.include?(code) true else false end end
#not_master? ⇒ true
| false
(readonly)
Whether the error is a “not master” error, or one of its variants.
# File 'lib/mongo/error/sdam_error_detection.rb', line 30
def not_master? # Require the error to be communicated at the top level of the response # for it to influence SDAM state. See DRIVERS-1376 / RUBY-2516. return false if document && document['ok'] == 1 if node_recovering? false elsif code NOT_MASTER_CODES.include?(code) elsif .include?('not master') else false end end