SdamErrorDetection — Documentation by YARD 0.9.37 (original) (raw)
Module: Mongo::Error::SdamErrorDetection
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 Summarycollapse
NOT_MASTER_CODES =
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.
[10107, 13435].freeze
NODE_RECOVERING_CODES =
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.
[11600, 11602, 13436, 189, 91, 10058].freeze
NODE_SHUTTING_DOWN_CODES =
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.
[11600, 91].freeze
Instance Method Summarycollapse
- #node_recovering? ⇒ true | false
Whether the error is a “node is recovering” error, or one of its variants. - #node_shutting_down? ⇒ true | false
Whether the error is a “node is shutting down” type error. - #not_master? ⇒ true | false
Whether the error is a “not master” error, or one of its variants.
Instance Method Details
#node_recovering? ⇒ true | false
| 53 54 55 56 57 58 59 60 61 62 63 64 65 | # File 'lib/mongo/error/sdam_error_detection.rb', line 53 def node_recovering? return false if document && document['ok'] == 1 if code NODE_RECOVERING_CODES.include?(code) elsif message message.include?('node is recovering') || message.include?('not master or secondary') else false end end | | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
#node_shutting_down? ⇒ true | false
74 75 76 77 78 79 80 | # 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
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # File 'lib/mongo/error/sdam_error_detection.rb', line 30 def not_master? return false if document && document['ok'] == 1 if node_recovering? false elsif code NOT_MASTER_CODES.include?(code) elsif message message.include?('not master') else false end end |
---|