rados_write_op_t write_op = rados_create_write_op();
printf("Created an Func for Object Operations");
rados_write_op_create(write_op(),LIBRADOS_CREATE_EXCLUSIVE, NULL);
printf("Created an Object For operation");
size_t p = 2; //No.of key value Pairs
char *key1="key1", *key2 = "key2"; //keys
char *key_arr[2] = {key1,key2}; //Pointer array to keys
int v1 = 21,v2 = 22; //values to associate to each key (integer form)
int *vals[2] = {&v1,&v2}; //pointer array storing the location of values to set
int lens[2] = {4,4};
rados_write_op_omap_set(write_op, key_arr, vals, lens, p); //func used to set those key-value pairs
printf("Set the key/value pairs on an object\n");
rados_write_op_operate(write_op,io,"keytest",NULL,0); //operated on object "keytest"
rados_release_write_op(write_op);
rados_read_op_t read_op = rados_create_read_op();
rados_omap_iter_t iter_vals;
int r_vals;
rados_read_op_omap_get_vals_by_keys(read_op,key_arr,p,&iter_vals,&r_vals); //To read the values of keys
rados_read_op_operate(read_op,io,"keytest",0);
printf("%D\n",r_vals);
rados_release_read_op(read_op);
Thanks
Mishal
LNM IIT JAIPUR
India