sdskv-client.h 21 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#ifndef sds_keyval_client_h
#define sds_keyval_client_h

#include <margo.h>
#include <stdint.h>
#include <sdskv-common.h>

#if defined(__cplusplus)
extern "C" {
#endif

typedef struct sdskv_client* sdskv_client_t;
#define SDSKV_CLIENT_NULL ((sdskv_client_t)NULL)

typedef struct sdskv_provider_handle *sdskv_provider_handle_t;
#define SDSKV_PROVIDER_HANDLE_NULL ((sdskv_provider_handle_t)NULL)

18 19 20 21 22 23

/**
 * @brief Global variable recording the last error encountered by REMI.
 */
extern int32_t sdskv_remi_errno;

24 25 26 27 28 29 30 31
/**
 * @brief Creates a SDSKV client.
 *
 * @param[in] mid Margo instance
 * @param[out] client SDSKV client
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
32 33
int sdskv_client_init(margo_instance_id mid, sdskv_client_t* client);

34 35 36 37 38 39 40
/**
 * @brief Finalizes a SDSKV client.
 *
 * @param[in] client SDSKV client to finalize
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
41 42
int sdskv_client_finalize(sdskv_client_t client);

43 44 45 46 47
/**
 * @brief Creates a SDSKV provider handle.
 *
 * @param[in] client SDSKV client responsible for the provider handle
 * @param[in] addr Mercury address of the provider
48
 * @param[in] provider_id id of the provider
49 50 51 52
 * @param[in] handle provider handle
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
53 54 55
int sdskv_provider_handle_create(
        sdskv_client_t client,
        hg_addr_t addr,
56
        uint16_t provider_id,
Matthieu Dorier's avatar
Matthieu Dorier committed
57 58
        sdskv_provider_handle_t* handle);

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
/**
 * @brief Retrieves the information (string address and provider id)
 * from a provider handle. If any argument is NULL, the corresponding
 * field will be ignored.
 *
 * @param[in] ph Provider handle.
 * @param[inout] client Client.
 * @param[inout] addr Address.
 * @param[inout] provider_id 
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_provider_handle_get_info(
        sdskv_provider_handle_t ph,
        sdskv_client_t* client,
        hg_addr_t* addr,
        uint16_t* provider_id);

77 78 79 80 81 82 83
/**
 * @brief Increments the reference counter of a provider handle.
 *
 * @param handle provider handle
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
84 85 86
int sdskv_provider_handle_ref_incr(
        sdskv_provider_handle_t handle);

87 88 89 90 91 92 93 94 95
/**
 * @brief Releases the provider handle. This will decrement the
 * reference counter, and free the provider handle if the reference
 * counter reaches 0.
 *
 * @param[in] handle provider handle to release.
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
96
int sdskv_provider_handle_release(sdskv_provider_handle_t handle);
Matthieu Dorier's avatar
Matthieu Dorier committed
97

98 99 100 101 102 103 104 105 106 107 108
/**
 * @brief Opens a database. This effectively contacts the provider
 * pointed to by the provider handle and request the database id
 * associated with the database name.
 *
 * @param[in] provider provider handle
 * @param[in] db_name name of the database to lookup
 * @param[out] db_id database id
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
109 110 111 112 113
int sdskv_open(
        sdskv_provider_handle_t provider,
        const char* db_name,
        sdskv_database_id_t* db_id);

114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
/**
 * @brief Gets the number of databases currently managed by a provider.
 *
 * @param[in] provider provider handle
 * @param[out] num number of databases
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_count_databases(
        sdskv_provider_handle_t provider,
        size_t* num);

/**
 * @brief Lists the databases names and ids.
 * The caller is responsible for calling free() on each of the
 * entries in db_names.
 *
 * @param[in]    provider provider handle
 * @param[inout] count    max number of databases to query, actual number returned
 * @param[out]   db_names database names
 * @param[out]   db_id    database ids
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_list_databases(
        sdskv_provider_handle_t provider,
        size_t* count,
        char** db_name,
        sdskv_database_id_t* db_id);

144 145 146 147 148 149 150 151 152 153 154 155
/**
 * @brief Puts a key/value pair into the database.
 *
 * @param provider provider handle managing the database
 * @param db_id targeted database id
 * @param key key to store
 * @param ksize size (in bytes) of the key
 * @param value value to store
 * @param vsize size (in bytes) of the value
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
156 157 158 159 160
int sdskv_put(sdskv_provider_handle_t provider, 
        sdskv_database_id_t db_id,
        const void *key, hg_size_t ksize,
        const void *value, hg_size_t vsize);

Matthieu Dorier's avatar
Matthieu Dorier committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
/**
 * @brief Puts multiple key/value pairs into the database.
 * This method will send all the key/value pairs in batch,
 * thus optimizing transfers by avoiding many RPC round trips.
 *
 * @param provider provider handle managing the database
 * @param db_id targeted database id
 * @param num number of key/value pairs to put
 * @param keys array of keys
 * @param ksizes array of key sizes
 * @param values array of values
 * @param vsizes array of value sizes
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_put_multi(sdskv_provider_handle_t provider,
        sdskv_database_id_t db_id,
Matthieu Dorier's avatar
Matthieu Dorier committed
178 179
        size_t num, const void* const* keys, const hg_size_t* ksizes,
        const void* const* values, const hg_size_t *vsizes);
Matthieu Dorier's avatar
Matthieu Dorier committed
180

181 182 183 184 185 186 187
/**
 * @brief Gets the value associated with a given key.
 * vsize needs to be set to the current size of the allocated
 * value buffer. After a succesful call to sdskv_get, vsize
 * will hold the actual size of the key. Note that the size
 * of a value can get obtained using sdskv_length.
 *
188 189 190
 * If value is NULL, the call will be equivalent
 * to sdskv_length and put the length of the value in *vsize.
 *
191 192 193
 * If the call returns SDSKV_ERR_SIZE, the value will be
 * unchanged but the vsize will be set to the required size.
 *
194 195 196 197 198 199 200 201 202
 * @param[in] provider provider handle
 * @param[in] db_id database id of the target database
 * @param[in] key key to lookup
 * @param[in] ksize size of the key
 * @param[out] value pointer to buffer to put the value
 * @param[inout] vsize size of the value
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
203 204 205 206 207
int sdskv_get(sdskv_provider_handle_t provider,
        sdskv_database_id_t db_id, 
        const void *key, hg_size_t ksize,
        void *value, hg_size_t* vsize);

Matthieu Dorier's avatar
Matthieu Dorier committed
208 209 210 211 212 213 214 215 216 217 218 219 220
/**
 * @brief Gets multiple values from the database. The transfers
 * will be performed in a single batch. The vsize array should
 * initially contain the size of the buffer allocated to receive
 * each value. After a successful call, this array will contain
 * the actual sizes of the values received. Contrary to sdskv_get,
 * this function will not produce an error if one of the keys
 * does not exist or if an allocated buffer is too small to hold
 * a given value: the corresponding value entry will simply not
 * be filled and its size will be set to 0 (so users must have
 * another way to distinguish a 0-sized value and a value for
 * which there was an error).
 *
221 222 223
 * If values is set to NULL, the call is equivalent to calling
 * sdskv_length_multi to get the size of the values.
 *
Matthieu Dorier's avatar
Matthieu Dorier committed
224 225 226 227 228 229 230 231 232 233 234 235
 * @param[in] provider provider handle
 * @param[in] db_id database id
 * @param[in] num number of keys to retrieve
 * @param[in] keys array of keys to retrieve
 * @param[in] ksizes size of the keys
 * @param[out] values array of allocated memory segments to receive the keys
 * @param[inout] vsizes sizes allocated (in) and actual sizes (out)
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_get_multi(sdskv_provider_handle_t provider,
        sdskv_database_id_t db_id,
Matthieu Dorier's avatar
Matthieu Dorier committed
236
        size_t num, const void* const* keys, const hg_size_t* ksizes,
Matthieu Dorier's avatar
Matthieu Dorier committed
237 238
        void** values, hg_size_t *vsizes);

239 240 241 242 243 244 245 246 247 248 249 250
/**
 * @brief Gets the length of a value associated with a given key.
 *
 * @param[in] handle provider handle
 * @param[in] db_id database id
 * @param[in] key key to lookup
 * @param[in] ksize size of the key
 * @param[out] vsize size of the associated value
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_length(sdskv_provider_handle_t handle, 
Matthieu Dorier's avatar
Matthieu Dorier committed
251 252 253
        sdskv_database_id_t db_id, const void *key, 
        hg_size_t ksize, hg_size_t* vsize);

Matthieu Dorier's avatar
Matthieu Dorier committed
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
/**
 * @brief Gets the length of values associated with multiple keys.
 * If a particular key does not exists, this function will set the length
 * of its value to 0 (so the user needs another way to differenciate 
 * between a key that does not exists and a 0-sized value).
 *
 * @param[in] handle provider handle
 * @param[in] db_id database id
 * @param[in] num number of keys
 * @param[in] keys array of keys
 * @param[in] ksizes array of key sizes
 * @param[out] vsizes array where to put value sizes
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_length_multi(sdskv_provider_handle_t handle,
        sdskv_database_id_t db_id, size_t num,
Matthieu Dorier's avatar
Matthieu Dorier committed
271
        const void* const* keys, const hg_size_t* ksizes,
Matthieu Dorier's avatar
Matthieu Dorier committed
272 273
        hg_size_t *vsizes);

274 275 276 277 278 279 280 281 282 283 284 285 286 287
/**
 * @brief Checks if the given key exists in the database.
 *
 * @param[in] handle provider handle
 * @param[in] db_id database id
 * @param[in] key key to lookup
 * @param[in] ksize size of the key
 * @param[out] flag 1 if the key exists, 0 otherwise
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_exists(sdskv_provider_handle_t handle,
        sdskv_database_id_t db_id, const void *key,
        hg_size_t ksize, int* flag);
288 289 290 291 292 293 294 295 296 297 298
/**
 * @brief Erases the key/value pair pointed by the given key.
 *
 * @param handle provider handle
 * @param db_id database id
 * @param key key to erase
 * @param ksize size of the key
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_erase(sdskv_provider_handle_t handle,
Matthieu Dorier's avatar
Matthieu Dorier committed
299 300 301
        sdskv_database_id_t db_id, const void *key,
        hg_size_t ksize);

Matthieu Dorier's avatar
Matthieu Dorier committed
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
/**
 * @brief Erases all the key/value pairs pointed to by the given keys.
 *
 * @param handle provider handle
 * @param db_id database id
 * @param num_keys number of keys
 * @param keys array of keys
 * @param ksizes array of key sizes
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_erase_multi(sdskv_provider_handle_t handle,
        sdskv_database_id_t db_id, size_t num_keys,
        const void* const* keys,
        const hg_size_t* ksizes);

318 319 320 321 322 323 324 325 326 327 328
/**
 * Lists at most max_keys keys starting strictly after start_key,
 * whether start_key is effectively in the database or not. "strictly after"
 * must be understood in the sens of the custom comparison function set
 * for the target database, if such comparison function has been set.
 * Passing NULL as start_key allows one to start listing from the beginning
 * of the database.
 * keys must be an array of max_keys void* elements, each element keys[i]
 * being a preallocated buffer of size ksizes[i]. ksizes must be an array
 * of sizes of the preallocated buffers. After a successful call, max_keys
 * is set to the actual number of keys retrieved, ksizes[i] is set to the
329 330 331 332 333 334
 * actual size of the i-th key, and keys[i] contains the i-th key.
 *
 * If at least one of the keys cannot fit in its buffer, the call will fail
 * and return SDSKV_ERR_SIZE, but the ksizes array will be updated to the
 * sizes required to fit each key, and max_keys will be updated to the number
 * of keys that can be listed. keys will be left untouched.
335 336 337 338 339 340 341 342 343 344 345
 *
 * @param[in] provider provider handle
 * @param[in] db_id database id
 * @param[in] start_key starting key
 * @param[in] start_ksize size of the starting key
 * @param[out] keys array of buffers to hold returned keys
 * @param[inout] ksizes array of key sizes
 * @param[inout] max_keys max keys requested
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
346 347
int sdskv_list_keys(
        sdskv_provider_handle_t provider,
348 349 350 351 352 353
        sdskv_database_id_t db_id,
        const void *start_key,
        hg_size_t start_ksize,
        void **keys,
        hg_size_t* ksizes,
        hg_size_t* max_keys);
Matthieu Dorier's avatar
Matthieu Dorier committed
354

355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
/**
 * @brief Same as sdskv_list_keys, but provides a prefix
 * that returned keys must start with. Note that "prefix" is understood
 * in the sens of the bytes making up the key, not in the sens of any
 * comparison function set by the user on the provider side.
 *
 * @param[in] provider provider handle
 * @param[in] db_id database id
 * @param[in] start_key starting key
 * @param[in] start_ksize size of the starting key
 * @param[in] prefix prefix that returned keys must match
 * @param[in] prefix_size size of the prefix
 * @param[out] keys array of buffers to hold returned keys
 * @param[inout] ksizes array of key sizes
 * @param[inout] max_keys max keys requested
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
373 374
int sdskv_list_keys_with_prefix(
        sdskv_provider_handle_t provider,
375 376 377 378
        sdskv_database_id_t db_id,
        const void *start_key,
        hg_size_t start_ksize,
        const void *prefix,
Matthieu Dorier's avatar
Matthieu Dorier committed
379
        hg_size_t prefix_size,
380 381 382
        void **keys,
        hg_size_t* ksizes, 
        hg_size_t* max_keys);
Matthieu Dorier's avatar
Matthieu Dorier committed
383

384 385 386 387 388 389 390
/**
 * @brief Same as sdskv_list_keys but returns also the values.
 * The values array must be an array of max_keys sizes, with
 * each element values[i] being a buffer of size vsizes[i].
 * After a successful call, values[i] will hold the i-th value
 * and vsizes[i] will be set to the actual size of the i-th value.
 *
391 392 393 394 395
 * If a buffer for a key or a value is too small, the call will fail
 * but ksizes and vsizes will be updated to the correct sizes needed,
 * and max_items will be updated to the number of entries that can be
 * listed.
 *
396 397 398 399 400 401 402 403 404 405 406 407
 * @param[in] provider provider handle
 * @param[in] db_id database id
 * @param[in] start_key starting key
 * @param[in] start_ksize size of the starting key
 * @param[out] keys array of buffers to hold returned keys
 * @param[inout] ksizes array of key sizes
 * @param[inout] values array of buffers to hold returned values
 * @param[inout] vsizes array of value sizes
 * @param[inout] max_keys max keys requested
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
408 409 410 411 412 413 414 415 416 417 418
int sdskv_list_keyvals(
        sdskv_provider_handle_t provider,
        sdskv_database_id_t db_id,
        const void *start_key,
        hg_size_t start_ksize,
        void **keys,
        hg_size_t* ksizes,
        void **values,
        hg_size_t* vsizes,
        hg_size_t* max_items);

419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
/**
 * @brief Same as sdskv_list_keyvals but lets the user provide
 * a prefix that returned keys must satisfy.
 *
 * @param[in] provider provider handle
 * @param[in] db_id database id
 * @param[in] start_key starting key
 * @param[in] start_ksize size of the starting key
 * @param[in] prefix prefix that returned keys must match
 * @param[in] prefix_size size of the prefix
 * @param[out] keys array of buffers to hold returned keys
 * @param[inout] ksizes array of key sizes
 * @param[inout] values array of buffers to hold returned values
 * @param[inout] vsizes array of value sizes
 * @param[inout] max_keys max keys requested
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
437 438 439 440 441 442 443 444 445 446 447 448 449
int sdskv_list_keyvals_with_prefix(
        sdskv_provider_handle_t provider,
        sdskv_database_id_t db_id,
        const void *start_key,
        hg_size_t start_ksize,
        const void *prefix,
        hg_size_t prefix_size,
        void **keys,
        hg_size_t* ksizes,
        void **values,
        hg_size_t* vsizes,
        hg_size_t* max_items);

450 451 452 453 454 455 456 457 458 459 460 461
/**
 * @brief Migrates a set of keys/values from a source provider/database
 * to a target provider/database.
 *
 * @param source_provider source provider
 * @param source_db_id source database id
 * @param target_addr target address
 * @param target_provider_id target provider id
 * @param target_db_id target database id
 * @param num_keys number of keys
 * @param keys array of keys
 * @param key_sizes array of key sizes
Matthieu Dorier's avatar
Matthieu Dorier committed
462
 * @param flag SDSKV_KEEP_ORIGINAL, or SDSKV_REMOVE_ORIGINAL
463 464 465 466 467 468 469 470 471 472
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_migrate_keys(
        sdskv_provider_handle_t source_provider,
        sdskv_database_id_t source_db_id,
        const char* target_addr,
        uint16_t target_provider_id,
        sdskv_database_id_t target_db_id,
        hg_size_t num_keys,
473
        const void* const* keys,
474 475 476 477 478 479 480 481 482 483 484 485 486 487
        const hg_size_t* key_sizes,
        int flag);

/**
 * @brief Migrates a single key/value from a source provider/database
 * to a target provider/database.
 *
 * @param source_provider source provider
 * @param source_db_id source database id
 * @param target_addr target address
 * @param target_provider_id target provider id
 * @param target_db_id target database id
 * @param key key to migrate
 * @param key_size size of the key 
Matthieu Dorier's avatar
Matthieu Dorier committed
488
 * @param flag SDSKV_KEEP_ORIGINAL, or SDSKV_REMOVE_ORIGINAL
489 490 491
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
492
static inline int sdskv_migrate_key(
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
        sdskv_provider_handle_t source_provider,
        sdskv_database_id_t source_db_id,
        const char* target_addr,
        uint16_t target_provider_id,
        sdskv_database_id_t target_db_id,
        const void* key,
        hg_size_t key_size,
        int flag)
{
    return sdskv_migrate_keys(
            source_provider,
            source_db_id,
            target_addr,
            target_provider_id,
            target_db_id,
            1,
            &key,
            &key_size,
            flag);
}

/**
 * @brief Migrates a set of keys/values from a source provider/database
 * to a target provider/database based on a range. The range is
 * expressed by the array key_range, which contains two elements.
 * key_range[0] must be a lower bound lb.
 * key_range[1] must be an upper bound ub.
Matthieu Dorier's avatar
Matthieu Dorier committed
520 521
 * The set of keys migrated are within the range ]lb, ub[ (i.e. lb
 * and ub not included).
522 523 524 525 526 527 528 529
 *
 * @param source_provider source provider
 * @param source_db_id source database id
 * @param target_addr target address
 * @param target_provider_id target provider id
 * @param target_db_id target database id
 * @param key_range range of keys to migrate
 * @param key_range_sizes size of the keys provided for the range 
Matthieu Dorier's avatar
Matthieu Dorier committed
530
 * @param flag SDSKV_KEEP_ORIGINAL, or SDSKV_REMOVE_ORIGINAL
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_migrate_key_range(
        sdskv_provider_handle_t source_provider,
        sdskv_database_id_t source_db_id,
        const char* target_addr,
        uint16_t target_provider_id,
        sdskv_database_id_t target_db_id,
        const void* key_range[],
        const hg_size_t key_range_sizes[],
        int flag);

/**
 * @brief Migrates a set of keys/values from a source provider/database
 * to a target provider/database based on a prefix. 
 * All key matching the provided prefix will be migrated.
 *
 * @param source_provider source provider
 * @param source_db_id source database id
 * @param target_addr target address
 * @param target_provider_id target provider id
 * @param target_db_id target database id
 * @param key_prefix prefix of keys to migrate
 * @param key_prefix_size size of the prefix provided 
Matthieu Dorier's avatar
Matthieu Dorier committed
556
 * @param flag SDSKV_KEEP_ORIGINAL, or SDSKV_REMOVE_ORIGINAL
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_migrate_keys_prefixed(
        sdskv_provider_handle_t source_provider,
        sdskv_database_id_t source_db_id,
        const char* target_addr,
        uint16_t target_provider_id,
        sdskv_database_id_t target_db_id,
        const void* key_prefix,
        hg_size_t key_prefix_size,
        int flag);

/**
 * @brief Migrates all the keys/values from a source provider/database
 * to a target provider/database based on a prefix. 
 *
 * @param source_provider source provider
 * @param source_db_id source database id
 * @param target_addr target address
 * @param target_provider_id target provider id
 * @param target_db_id target database id
Matthieu Dorier's avatar
Matthieu Dorier committed
579
 * @param flag SDSKV_KEEP_ORIGINAL, or SDSKV_REMOVE_ORIGINAL
580 581 582 583 584 585 586 587 588 589 590
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_migrate_all_keys(
        sdskv_provider_handle_t source_provider,
        sdskv_database_id_t source_db_id,
        const char* target_addr,
        uint16_t target_provider_id,
        sdskv_database_id_t target_db_id,
        int flag);

591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613
/**
 * @brief Migrate an entire database to a target destination provider.
 * Note that the database will not have the same id at the destination
 * so the user should call sdskv_open to re-open the database at its
 * destination.
 *
 * @param[in] source Source provider.
 * @param[in] source_db_id Source provider id.
 * @param[in] dest_addr Address of the destination provider.
 * @param[in] dest_provider_id Provider id of the destination provider.
 * @param[in] dest_root Root path at the destination.
 * @param[in] flag SDSKV_KEEP_ORIGINAL, or SDSKV_REMOVE_ORIGINAL
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
 */
int sdskv_migrate_database(
        sdskv_provider_handle_t source,
        sdskv_database_id_t source_db_id,
        const char* dest_addr,
        uint16_t dest_provider_id,
        const char* dest_root,
        int flag);

Matthieu Dorier's avatar
Matthieu Dorier committed
614 615 616 617 618 619
/**
 * Shuts down a remote SDSKV service (given an address).
 * This will shutdown all the providers on the target address.
 * 
 * @param [in] client SDSKV client
 * @param [in] addr address of the server 
620 621
 *
 * @return SDSKV_SUCCESS or error code defined in sdskv-common.h
Matthieu Dorier's avatar
Matthieu Dorier committed
622 623 624 625
 */
int sdskv_shutdown_service(
        sdskv_client_t client, hg_addr_t addr);

Matthieu Dorier's avatar
Matthieu Dorier committed
626 627 628 629 630
#if defined(__cplusplus)
}
#endif

#endif