Class: Combi::ResponseStore
- Inherits:
-
Object
- Object
- Combi::ResponseStore
- Defined in:
- lib/combi/response_store.rb
Instance Method Summary collapse
- #add_waiter(key, waiter) ⇒ Object
- #handle_rpc_response(response) ⇒ Object
-
#initialize ⇒ ResponseStore
constructor
A new instance of ResponseStore.
Constructor Details
#initialize ⇒ ResponseStore
Returns a new instance of ResponseStore.
5 6 7 |
# File 'lib/combi/response_store.rb', line 5 def initialize() @waiters = {} end |
Instance Method Details
#add_waiter(key, waiter) ⇒ Object
9 10 11 |
# File 'lib/combi/response_store.rb', line 9 def add_waiter(key, waiter) @waiters[key] = waiter end |
#handle_rpc_response(response) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/combi/response_store.rb', line 13 def handle_rpc_response(response) correlation_id = response['correlation_id'] waiter = @waiters[correlation_id] response = response['response'] waiter.succeed(response) @waiters.delete correlation_id end |