remi-client.h 3.31 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
#ifndef __REMI_CLIENT_H
#define __REMI_CLIENT_H

#include <remi/remi-common.h>
10
#include <abt-io.h>
Matthieu Dorier's avatar
Matthieu Dorier committed
11 12 13 14 15 16
#include <margo.h>

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

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

Matthieu Dorier's avatar
Matthieu Dorier committed
23 24 25
/**
 * @brief REMI provider handle type.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
26 27 28
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
29 30 31 32
/**
 * @brief Initializes a REMI client.
 *
 * @param[in] mid Margo instance.
33
 * @param[in] abtio ABT-IO instance.
Matthieu Dorier's avatar
Matthieu Dorier committed
34 35 36 37
 * @param[out] client Resulting client.
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
38 39 40 41
int remi_client_init(
        margo_instance_id mid, 
        abt_io_instance_id abtio,
        remi_client_t* client);
Matthieu Dorier's avatar
Matthieu Dorier committed
42

Matthieu Dorier's avatar
Matthieu Dorier committed
43 44 45 46 47 48 49
/**
 * @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
50 51
int remi_client_finalize(remi_client_t client);

Matthieu Dorier's avatar
Matthieu Dorier committed
52 53 54 55 56 57 58 59 60 61
/**
 * @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
62 63 64 65 66 67
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
68 69 70 71 72 73 74
/**
 * @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
75 76
int remi_provider_handle_ref_incr(remi_provider_handle_t handle);

Matthieu Dorier's avatar
Matthieu Dorier committed
77 78 79 80 81 82 83 84 85
/**
 * @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
86 87
int remi_provider_handle_release(remi_provider_handle_t handle);

Matthieu Dorier's avatar
Matthieu Dorier committed
88 89 90 91 92 93 94 95
/**
 * @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
96
int remi_shutdown_service(remi_client_t client, hg_addr_t addr);
Matthieu Dorier's avatar
Matthieu Dorier committed
97

Matthieu Dorier's avatar
Matthieu Dorier committed
98 99 100 101 102 103 104 105 106 107
/**
 * @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.
108 109
 * @param remove_source REMI_REMOVE_SOURCE or REMI_KEEP_SOURCE.
 * @param mode REMI_USE_MMAP or REMI_USE_ABTIO.
110
 * @param status Value returned by the user-defined migration callbacks.
Matthieu Dorier's avatar
Matthieu Dorier committed
111 112 113
 *
 * @return REMI_SUCCESS or error code defined in remi-common.h.
 */
Matthieu Dorier's avatar
Matthieu Dorier committed
114 115 116
int remi_fileset_migrate(
        remi_provider_handle_t handle,
        remi_fileset_t fileset,
117
        const char* remote_root,
118 119
        int remove_source,
        int mode,
120
        int* status);
Matthieu Dorier's avatar
Matthieu Dorier committed
121

Matthieu Dorier's avatar
Matthieu Dorier committed
122 123 124 125 126
#if defined(__cplusplus)
}
#endif

#endif