remi-client.h 3.03 KB
Newer Older
Matthieu Dorier's avatar
Matthieu Dorier committed
1 2 3 4 5
/*
 * (C) 2018 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
6 7 8 9 10 11 12 13 14 15
#ifndef __REMI_CLIENT_H
#define __REMI_CLIENT_H

#include <remi/remi-common.h>
#include <margo.h>

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

Matthieu Dorier's avatar
Matthieu Dorier committed
16 17 18
/**
 * @brief REMI client type.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
19 20 21
typedef struct remi_client* remi_client_t;
#define REMI_CLIENT_NULL ((remi_client_t)0)

Matthieu Dorier's avatar
Matthieu Dorier committed
22 23 24
/**
 * @brief REMI provider handle type.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
25 26 27
typedef struct remi_provider_handle* remi_provider_handle_t;
#define REMI_PROVIDER_HANDLE_NULL ((remi_provider_handle_t)0)

Matthieu Dorier's avatar
Matthieu Dorier committed
28 29 30 31 32 33 34 35
/**
 * @brief Initializes a REMI client.
 *
 * @param[in] mid Margo instance.
 * @param[out] client Resulting client.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
36 37
int remi_client_init(margo_instance_id mid, remi_client_t* client);

Matthieu Dorier's avatar
Matthieu Dorier committed
38 39 40 41 42 43 44
/**
 * @brief Finalizes a REMI client.
 *
 * @param client REMI client.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
45 46
int remi_client_finalize(remi_client_t client);

Matthieu Dorier's avatar
Matthieu Dorier committed
47 48 49 50 51 52 53 54 55 56
/**
 * @brief Creates a REMI provider handle.
 *
 * @param[in] client REMI client.
 * @param[in] addr Mercury address of the provider.
 * @param[in] provider_id Provider id.
 * @param[out] handle Resulting provider handle.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
57 58 59 60 61 62
int remi_provider_handle_create(
        remi_client_t client,
        hg_addr_t addr,
        uint16_t provider_id,
        remi_provider_handle_t* handle);

Matthieu Dorier's avatar
Matthieu Dorier committed
63 64 65 66 67 68 69
/**
 * @brief Increments the reference counter of the provider handle.
 *
 * @param[in] handle Provider handle.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
70 71
int remi_provider_handle_ref_incr(remi_provider_handle_t handle);

Matthieu Dorier's avatar
Matthieu Dorier committed
72 73 74 75 76 77 78 79 80
/**
 * @brief Releases the provider handle. This function will decrement
 * the reference count and free the provider handle if the reference
 * count reaches 0.
 *
 * @param[in] handle Provider handle.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
81 82
int remi_provider_handle_release(remi_provider_handle_t handle);

Matthieu Dorier's avatar
Matthieu Dorier committed
83 84 85 86 87 88 89 90
/**
 * @brief Helper function wrapping margo_shutdown_remote_instance.
 *
 * @param[in] client REMI client.
 * @param[in] addr Address of the remote instance to shutdown.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
91
int remi_shutdown_service(remi_client_t client, hg_addr_t addr);
Matthieu Dorier's avatar
Matthieu Dorier committed
92

Matthieu Dorier's avatar
Matthieu Dorier committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106
/**
 * @brief Migrates a fileset to a remote provider. All the files
 * of the local fileset will be transfered over RDMA to the destination
 * provider and a remote fileset will be created with the provided
 * remote root. If flag is set to REMI_REMOVE_SOURCE, the original
 * files will be destroyed.
 *
 * @param handle Provider handle of the target provider.
 * @param fileset Fileset to migrate.
 * @param remote_root Root of the fileset when migrated.
 * @param flag REMI_REMOVE_SOURCE or REMI_KEEP_SOURCE.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
107 108 109
int remi_fileset_migrate(
        remi_provider_handle_t handle,
        remi_fileset_t fileset,
110
        const char* remote_root,
Matthieu Dorier's avatar
Matthieu Dorier committed
111 112
        int flag);

Matthieu Dorier's avatar
Matthieu Dorier committed
113 114 115 116 117
#if defined(__cplusplus)
}
#endif

#endif