Class: RedisHA::Router::Upstream
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- RedisHA::Router::Upstream
- Includes:
- Logger
- Defined in:
- lib/redis_ha/router/upstream.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#name ⇒ Object
Returns the value of attribute name.
-
#plexer ⇒ Object
Returns the value of attribute plexer.
Instance Method Summary collapse
- #connection_completed ⇒ Object
-
#initialize(debug_on = false) ⇒ Upstream
constructor
A new instance of Upstream.
- #receive_data(data) ⇒ Object
- #send(data) ⇒ Object
- #ubind ⇒ Object
Constructor Details
#initialize(debug_on = false) ⇒ Upstream
Returns a new instance of Upstream.
8 9 10 11 |
# File 'lib/redis_ha/router/upstream.rb', line 8 def initialize debug_on=false @debug = debug_on @connected = EM::DefaultDeferrable.new end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
6 7 8 |
# File 'lib/redis_ha/router/upstream.rb', line 6 def debug @debug end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/redis_ha/router/upstream.rb', line 6 def name @name end |
#plexer ⇒ Object
Returns the value of attribute plexer.
6 7 8 |
# File 'lib/redis_ha/router/upstream.rb', line 6 def plexer @plexer end |
Instance Method Details
#connection_completed ⇒ Object
13 14 15 16 17 |
# File 'lib/redis_ha/router/upstream.rb', line 13 def connection_completed logger.debug [@name, :conn_complete] @plexer.connected(@name) @connected.succeed end |
#receive_data(data) ⇒ Object
19 20 21 22 |
# File 'lib/redis_ha/router/upstream.rb', line 19 def receive_data data logger.debug [@name, data] @plexer.relay_from_upstream(@name, data) end |
#send(data) ⇒ Object
24 25 26 |
# File 'lib/redis_ha/router/upstream.rb', line 24 def send data @connected.callback { send_data data } end |
#ubind ⇒ Object
28 29 30 31 |
# File 'lib/redis_ha/router/upstream.rb', line 28 def ubind logger.debug [@name, :unbind] @plexer.unbind_backend(@name) end |