Method: B2::Connection#initialize

Defined in:
lib/b2/connection.rb

#initialize(key_id, secret, pool: 5, timeout: 5) ⇒ Connection

Returns a new instance of Connection.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/b2/connection.rb', line 7

def initialize(key_id, secret, pool: 5, timeout: 5)
  @mutex        = Mutex.new
  @availability = ConditionVariable.new
  @max          = pool
  @timeout      = timeout
  @free_pool    = []
  @used_pool    = []
  
  @key_id = key_id
  @key_secret = secret

  @buckets_cache = Hash.new { |hash, name| hash[name] = bucket(name) }
end