Class: RedisFailover::FailoverStrategy
- Inherits:
-
Object
- Object
- RedisFailover::FailoverStrategy
- Includes:
- Util
- Defined in:
- lib/redis_failover/failover_strategy.rb,
lib/redis_failover/failover_strategy/latency.rb
Overview
Base class for strategies that determine which node is used during failover.
Direct Known Subclasses
Defined Under Namespace
Classes: Latency
Constant Summary
Constants included from Util
Util::CONNECTIVITY_ERRORS, Util::DEFAULT_ROOT_ZNODE_PATH, Util::REDIS_ERRORS, Util::REDIS_READ_OPS, Util::UNSUPPORTED_OPS, Util::ZK_ERRORS
Class Method Summary collapse
-
.for(name) ⇒ Object
Loads a strategy based on the given name.
Instance Method Summary collapse
-
#find_candidate(snapshots) ⇒ Node
Returns a candidate node as determined by this strategy.
Methods included from Util
#decode, #different?, #encode, logger, #logger, logger=, #symbolize_keys
Class Method Details
.for(name) ⇒ Object
Loads a strategy based on the given name.
10 11 12 13 14 15 |
# File 'lib/redis_failover/failover_strategy.rb', line 10 def self.for(name) require "redis_failover/failover_strategy/#{name.downcase}" const_get(name.capitalize).new rescue LoadError, NameError raise "Failed to find failover strategy: #{name}" end |
Instance Method Details
#find_candidate(snapshots) ⇒ Node
Returns a candidate node as determined by this strategy.
21 22 23 |
# File 'lib/redis_failover/failover_strategy.rb', line 21 def find_candidate(snapshots) raise NotImplementedError end |