Module: Moped::Failover
- Extended by:
- Failover
- Included in:
- Failover
- Defined in:
- lib/moped/failover.rb,
lib/moped/failover/retry.rb,
lib/moped/failover/ignore.rb,
lib/moped/failover/disconnect.rb,
lib/moped/failover/reconfigure.rb
Overview
Provides behaviour around failover scenarios for different types of exceptions that get raised on connection and execution of operations.
Defined Under Namespace
Modules: Disconnect, Ignore, Reconfigure, Retry
Constant Summary collapse
- STRATEGIES =
Hash lookup for the failover classes based off the exception type.
{ Errors::AuthenticationFailure => Ignore, Errors::ConnectionFailure => Retry, Errors::CursorNotFound => Ignore, Errors::OperationFailure => Reconfigure, Errors::QueryFailure => Reconfigure }.freeze
Instance Method Summary collapse
-
#get(exception) ⇒ Object
Get the appropriate failover handler given the provided exception.
Instance Method Details
#get(exception) ⇒ Object
Get the appropriate failover handler given the provided exception.
37 38 39 |
# File 'lib/moped/failover.rb', line 37 def get(exception) STRATEGIES.fetch(exception.class, Disconnect) end |