Class: EM::Voldemort::Connection::FailHandler
- Inherits:
-
Object
- Object
- EM::Voldemort::Connection::FailHandler
- Defined in:
- lib/em-voldemort/connection.rb
Overview
Quacks like a EM::Voldemort::Connection::Handler, but fails all requests. Useful for representing a connection in an error state.
Instance Attribute Summary collapse
-
#in_flight ⇒ Object
readonly
Returns the value of attribute in_flight.
Instance Method Summary collapse
- #close_gracefully ⇒ Object
- #enqueue_request(request) ⇒ Object
-
#initialize(connection) ⇒ FailHandler
constructor
A new instance of FailHandler.
Constructor Details
#initialize(connection) ⇒ FailHandler
Returns a new instance of FailHandler.
219 220 221 |
# File 'lib/em-voldemort/connection.rb', line 219 def initialize(connection) @connection = connection end |
Instance Attribute Details
#in_flight ⇒ Object (readonly)
Returns the value of attribute in_flight.
217 218 219 |
# File 'lib/em-voldemort/connection.rb', line 217 def in_flight @in_flight end |
Instance Method Details
#close_gracefully ⇒ Object
229 230 231 |
# File 'lib/em-voldemort/connection.rb', line 229 def close_gracefully @connection.connection_closed(self) end |
#enqueue_request(request) ⇒ Object
223 224 225 226 227 |
# File 'lib/em-voldemort/connection.rb', line 223 def enqueue_request(request) EM::DefaultDeferrable.new.tap do |deferrable| deferrable.fail(ServerError.new('Connection to Voldemort node closed')) end end |