Class: Waterfall::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/waterfall/client.rb

Defined Under Namespace

Classes: ClientWrapper

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



7
8
9
10
# File 'lib/waterfall/client.rb', line 7

def initialize(options = {})
  settings = {host: 'localhost', port: 5290}.merge(options)
  @pool = ConnectionPool.new { ClientWrapper.new(settings) }
end

Instance Method Details

#closeObject



19
20
21
# File 'lib/waterfall/client.rb', line 19

def close
  @pool.shutdown { |client| client.close }
end

#next_idObject



12
13
14
15
16
# File 'lib/waterfall/client.rb', line 12

def next_id
  @pool.with do |client|
    client.next_id
  end
end