Class: FDB::FutureKeyValueArray

Inherits:
Future
  • Object
show all
Defined in:
lib/fdbimpl.rb

Instance Method Summary collapse

Methods inherited from Future

#block_until_ready, #callback_wrapper, #cancel, finalize, #initialize, #on_ready, #ready?, wait_for_any

Constructor Details

This class inherits a constructor from FDB::Future

Instance Method Details

#waitObject



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/fdbimpl.rb', line 458

def wait
  block_until_ready

  kvs = FFI::MemoryPointer.new :pointer
  count = FFI::MemoryPointer.new :int
  more = FFI::MemoryPointer.new :int
  FDBC.check_error FDBC.fdb_future_get_keyvalue_array(@fpointer, kvs, count, more)
  kvs = kvs.read_pointer

  [(0..count.read_int-1).map{|i|
    x = FDBC::KeyValueStruct.new(kvs + (i * FDBC::KeyValueStruct.size))
    KeyValue.new(x[:key].read_bytes(x[:key_length]),
                 x[:value].read_bytes(x[:value_length]))
   }, count.read_int, more.read_int]
end