Class: Carbon::Reader
- Inherits:
-
Object
- Object
- Carbon::Reader
- Defined in:
- lib/carbon/reader.rb
Defined Under Namespace
Modules: ServerProtocol Classes: FetchQueue
Instance Method Summary collapse
- #close ⇒ Object
- #fetch(query, &callback) ⇒ Object
-
#initialize(hostname, port, logger) ⇒ Reader
constructor
A new instance of Reader.
Constructor Details
#initialize(hostname, port, logger) ⇒ Reader
Returns a new instance of Reader.
5 6 7 8 9 |
# File 'lib/carbon/reader.rb', line 5 def initialize(hostname, port, logger) @queue = FetchQueue.new @logger = logger @connection = EM::connect(hostname, port, ServerProtocol, @queue, @logger) end |
Instance Method Details
#close ⇒ Object
11 12 13 |
# File 'lib/carbon/reader.rb', line 11 def close @connection.close_connection end |
#fetch(query, &callback) ⇒ Object
15 16 17 |
# File 'lib/carbon/reader.rb', line 15 def fetch(query, &callback) @queue.push([query, callback]) end |