mobject needs a `list_keys`
For the Mobject application, the following functions should be added:
hg_return_t kv_list_keys(kv_database_t *db, // db instance const void *start_key, // we want keys strictly after this start_key hg_size_t start_ksize, // size of the start_key void **keys, // pointer to an array of void* pointers, // this array has size *max_keys hg_size_t* ksizes, // pointer to an array of hg_size_t sizes // representing sizes allocated in keys for each key hg_size_t* max_keys); // maximum number of keys requested
This function lists all the keys that are greater than the
start_key (for whatever comparison function was setup on the server side). We provide an array (
keys) of addresses to allocated memory regions that will hold the keys. We provide an array (
ksizes) of sizes representing the amount of memory allocated for each key. After the call, this array contains the actual sizes of keys. If for a given key
k the actual size is greater than the one provided,
ksizes[k] is set to the actual size and
keys[k] is set to
NULL, in order to tell the user that this key was not fetched.
A similar function
kv_list_keys_with_prefix() should be provided that has the same arguments, plus a
const void* prefix and a
hg_size_t prefix_size. The function should return only the keys that start with the specified prefix.