class Couchbase::Async::Queue

Public Class Methods

new(bucket) click to toggle source
# File lib/couchbase/async/queue.rb, line 5
def initialize(bucket)
  @bucket  = bucket
  @futures = []
end

Public Instance Methods

add_future(future, options, &block) click to toggle source
# File lib/couchbase/async/queue.rb, line 10
def add_future(future, options, &block)
  @futures << [ future, options, block ]
end
join() click to toggle source
# File lib/couchbase/async/queue.rb, line 14
def join
  while future = @futures.pop
    begin
      future, options, callback = future
      future.get
      result = Couchbase::Result.new({ bucket: @bucket, future: future }.merge(options))
      callback.call(result) unless callback.nil?
    end
  end
end