I’ve been using range reads in the FoundationDB C API with the following code:
FDBFuture *future = fdb_transaction_get_range(tr, beginKey, beginKeySize, 0, 0, endKey, endKeySize, 0, 0, limit, 0, FDB_STREAMING_MODE_WANT_ALL, 0, 0, 0); //Wait for future and check errors... int outMore, outCount; FDBKeyValue *keyValue = fdb_future_get_keyvalue_array(future, &keyValue, &outCount, &outMore); printf("%d\n", outCount); printf("%.*s\n", keyValue.key_length, keyValue.key); printf("%.*s\n", keyValue.key_length, keyValue.key); printf("%.*s\n", keyValue.key_length, keyValue.key); printf("%.*s\n", keyValue.key_length, keyValue.key);
When I run
getrange '' \xff, I get:
`hello' is `world' `hi' is `everyone' `mykey` is `myvalue'
However, the output of my C program is:
3 hello hi
The first pair (
keyValue) is empty. The next pairs are present, however I would expect
hello to be at position 0, and
hi to be at position 1. When reading
keyValue, nothing is present, as expected.
I have a few questions:
- How can I get all 3 pairs?
- Why is
I would appreciate any help. Thanks!