Commit 6b18039a authored by David Rich's avatar David Rich Committed by Rob Latham
Browse files

Can't do by-reference in C. Sigh.

parent 5c1e7320
......@@ -124,13 +124,13 @@ hg_return_t kv_put(kv_context *context, void *key, void *value) {
return ret;
}
hg_return_t kv_bulk_put(kv_context *context, void *key, void *data, hg_size_t data_size) {
hg_return_t kv_bulk_put(kv_context *context, void *key, void *data, uint64_t *data_size) {
hg_return_t ret;
bulk_put_in_t bpin;
bulk_put_out_t bpout;
bpin.key = *(uint64_t*)key;
bpin.size = data_size;
bpin.size = *(uint64_t*)data_size;
ret = margo_bulk_create(context->mid, 1, &data, &data_size,
HG_BULK_READ_ONLY, &bpin.bulk_handle);
assert(ret == HG_SUCCESS);
......@@ -161,7 +161,7 @@ hg_return_t kv_get(kv_context *context, void *key, void *value)
return ret;
}
hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t &data_size)
hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, uint64_t *data_size)
{
hg_return_t ret;
bulk_get_in_t bgin;
......@@ -170,8 +170,8 @@ hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t &d
int32_t bgret;
bgin.key = *(uint64_t*)key;
bgin.size = data_size;
ret = margo_bulk_create(context->mid, 1, &data, &data_size,
bgin.size = *(uint64_t*)data_size;
ret = margo_bulk_create(context->mid, 1, &data, data_size,
HG_BULK_WRITE_ONLY, &bgin.bulk_handle);
assert(ret == HG_SUCCESS);
ret = margo_forward(context->bulk_get_handle, &bgin);
......@@ -179,7 +179,7 @@ hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t &d
ret = margo_get_output(context->bulk_get_handle, &bgout);
assert(ret == HG_SUCCESS);
assert(bgout.ret == HG_SUCCESS); // make sure the server side says all is OK
data_size = bgout.size; // report actual size of data transferred to caller
*data_size = (uint64_t)bgout.size; // report actual size of data transferred to caller
margo_free_output(context->bulk_get_handle, &bgout);
return HG_SUCCESS;
......
......@@ -139,9 +139,9 @@ hg_return_t kv_client_signal_shutdown(kv_context *context);
hg_return_t kv_open(kv_context *context, char *server, char *name,
kv_type keytype, kv_type valtype);
hg_return_t kv_put(kv_context *context, void *key, void *value);
hg_return_t kv_bulk_put(kv_context *context, void *key, void *data, hg_size_t &data_size);
hg_return_t kv_bulk_put(kv_context *context, void *key, void *data, uint64_t *data_size);
hg_return_t kv_get(kv_context *context, void *key, void *value);
hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, hg_size_t &data_size);
hg_return_t kv_bulk_get(kv_context *context, void *key, void *data, uint64_t *data_size);
hg_return_t kv_close(kv_context *context);
bench_result *kv_benchmark(kv_context *context, int count);
......
......@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
get_data.resize(sizeof(get_val));
uint64_t data_size = get_data.size();
printf("(get) key %lu, estimated size=%lu\n", key, data_size);
hret = kv_bulk_get(context, (void*)&key, (void*)get_data.data(), data_size);
hret = kv_bulk_get(context, (void*)&key, (void*)get_data.data(), &data_size);
DIE_IF(hret != HG_SUCCESS, "kv_bulk_get");
printf("(get) key %lu, actual size=%lu\n", key, data_size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment