Sha256: ed98e9b8d997e2d80ec61eb5568708e5bab4e8ab7ee8b4aaf669ad8be09fa793

Contents?: true

Size: 879 Bytes

Versions: 4

Compression:

Stored size: 879 Bytes

Contents

module RedisFailover
  class NodeManagerStub < NodeManager
    def parse_nodes
      master = Node.new(:host => 'master')
      slave = Node.new(:host => 'slave')
      [master, slave].each { |node| node.extend(RedisStubSupport) }
      master.make_master!
      slave.make_slave!(master)
      [master, [slave]]
    end

    def master
      @master
    end

    def slaves
      @slaves
    end

    def start_processing
      @thread = Thread.new { start }
    end

    def stop_processing
      @queue << nil
      @thread.value
    end

    def force_unreachable(node)
      start_processing
      node.redis.make_unreachable!
      notify_state_change(node, :unreachable)
      stop_processing
    end

    def force_reachable(node)
      start_processing
      node.redis.make_reachable!
      notify_state_change(node, :reachable)
      stop_processing
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redis_failover-0.3.0 spec/support/node_manager_stub.rb
redis_failover-0.2.0 spec/support/node_manager_stub.rb
redis_failover-0.1.1 spec/support/node_manager_stub.rb
redis_failover-0.1.0 spec/support/node_manager_stub.rb