Method: Aerospike::Recordset#initialize

Defined in:
lib/aerospike/query/recordset.rb

#initialize(queue_size = 5000, thread_count = 1, type) ⇒ Recordset

Returns a new instance of Recordset.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/aerospike/query/recordset.rb', line 27

def initialize(queue_size = 5000, thread_count = 1, type)
  queue_size = thread_count if queue_size < thread_count
  @records = SizedQueue.new(queue_size)

  # holds the count of active threads.
  # when it reaches zero it means the whole operations of fetching records from server nodes is finished
  @active_threads = Atomic.new(thread_count)

  # operation cancelled by user or an exception occured in one of the threads
  @cancelled = Atomic.new(false)

  # saves the exception that occurred inside one of the threads to reraise it in the main thread
  # and also is a signal to terminate other threads as the whole operation is assumed as failed
  @thread_exception = Atomic.new(nil)

  # type of the operation. it is either :scan or :query
  @type = type
end