bake-bulk-rpc.h 3.72 KB
Newer Older
Philip Carns's avatar
Philip Carns committed
1
2
3
4
5
6
/*
 * (C) 2015 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */

7
8
#ifndef __BAKE_BULK_RPC
#define __BAKE_BULK_RPC
Philip Carns's avatar
Philip Carns committed
9
10

#include <margo.h>
11
#include <bake-bulk.h>
Philip Carns's avatar
Philip Carns committed
12

13
14
15
16
/* encoders for bake-specific types */
static inline hg_return_t hg_proc_bake_target_id_t(hg_proc_t proc, bake_target_id_t *bti);
static inline hg_return_t hg_proc_bake_bulk_region_id_t(hg_proc_t proc, bake_bulk_region_id_t *rid);
/* shutdown */
Philip Carns's avatar
Philip Carns committed
17
18
DECLARE_MARGO_RPC_HANDLER(bake_bulk_shutdown_ult)

19
20
21
22
23
24
25
26
27
/* bulk create */
MERCURY_GEN_PROC(bake_bulk_create_in_t,
    ((bake_target_id_t)(bti))\
    ((uint64_t)(region_size)))
MERCURY_GEN_PROC(bake_bulk_create_out_t,
    ((int32_t)(ret))\
    ((bake_bulk_region_id_t)(rid)))
DECLARE_MARGO_RPC_HANDLER(bake_bulk_create_ult)

Philip Carns's avatar
Philip Carns committed
28
29
30
31
32
33
34
35
/* bulk write */
MERCURY_GEN_PROC(bake_bulk_write_in_t,
    ((bake_target_id_t)(bti))\
    ((bake_bulk_region_id_t)(rid))\
    ((uint64_t)(region_offset))\
    ((hg_bulk_t)(bulk_handle)))
MERCURY_GEN_PROC(bake_bulk_write_out_t,
    ((int32_t)(ret)))
36
DECLARE_MARGO_RPC_HANDLER(bake_bulk_write_ult)
37

Philip Carns's avatar
Philip Carns committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* bulk eager write */
typedef struct 
{
    bake_target_id_t bti;
    bake_bulk_region_id_t rid;
    uint64_t region_offset;
    uint32_t size;
    char * buffer;
} bake_bulk_eager_write_in_t;
static inline hg_return_t hg_proc_bake_bulk_eager_write_in_t(hg_proc_t proc, bake_bulk_eager_write_in_t *in);
MERCURY_GEN_PROC(bake_bulk_eager_write_out_t,
    ((int32_t)(ret)))
DECLARE_MARGO_RPC_HANDLER(bake_bulk_eager_write_ult)


Philip Carns's avatar
Philip Carns committed
53
54
55
56
57
58
59
60
/* bulk persist */
MERCURY_GEN_PROC(bake_bulk_persist_in_t,
    ((bake_target_id_t)(bti))\
    ((bake_bulk_region_id_t)(rid)))
MERCURY_GEN_PROC(bake_bulk_persist_out_t,
    ((int32_t)(ret)))
DECLARE_MARGO_RPC_HANDLER(bake_bulk_persist_ult)

61
62
63
64
65
66
67
68
69
/* bulk get size */
MERCURY_GEN_PROC(bake_bulk_get_size_in_t,
    ((bake_target_id_t)(bti))\
    ((bake_bulk_region_id_t)(rid)))
MERCURY_GEN_PROC(bake_bulk_get_size_out_t,
    ((int32_t)(ret))\
    ((uint64_t)(size)))
DECLARE_MARGO_RPC_HANDLER(bake_bulk_get_size_ult)

70
71
72
73
74
75
76
77
78
79
/* bulk read */
MERCURY_GEN_PROC(bake_bulk_read_in_t,
    ((bake_target_id_t)(bti))\
    ((bake_bulk_region_id_t)(rid))\
    ((uint64_t)(region_offset))\
    ((hg_bulk_t)(bulk_handle)))
MERCURY_GEN_PROC(bake_bulk_read_out_t,
    ((int32_t)(ret)))
DECLARE_MARGO_RPC_HANDLER(bake_bulk_read_ult)

80
81
82
83
84
85
/* bulk probe */
MERCURY_GEN_PROC(bake_bulk_probe_out_t,
    ((int32_t)(ret))\
    ((bake_target_id_t)(bti)))
DECLARE_MARGO_RPC_HANDLER(bake_bulk_probe_ult)

Philip Carns's avatar
Philip Carns committed
86
87
88
/* noop */
DECLARE_MARGO_RPC_HANDLER(bake_bulk_noop_ult)

89
90
91
92
93
94
95
96
/* TODO: this should be somewhere else, just putting in this header for
 * convenience right now.  The type should only be visible to the server
 * daemon and the rpc handlers.
 */
struct bake_bulk_root
{
    bake_target_id_t target_id;
};
Philip Carns's avatar
Philip Carns committed
97
98


Philip Carns's avatar
Philip Carns committed
99
100
101
/* TODO: where should the encoder defs live?  Not in bake-bulk-rpc.c because 
 * we don't really need the rpc handlers to be linked into clients...
 */
102
103
104
static inline hg_return_t hg_proc_bake_bulk_region_id_t(hg_proc_t proc, bake_bulk_region_id_t *rid)
{
    /* TODO: update later depending on final region_id_t type */
Philip Carns's avatar
Philip Carns committed
105
    /* TODO: need separate encoders for different backend types */
106
107
108
    int i;
    hg_return_t ret;

Philip Carns's avatar
Philip Carns committed
109
110
    hg_proc_hg_uint32_t(proc, &rid->type);
    for(i=0; i<BAKE_BULK_REGION_ID_DATA_SIZE; i++)
111
112
113
114
115
116
117
118
119
120
    {
        ret = hg_proc_hg_uint8_t(proc, (uint8_t*)&rid->data[i]);
        if(ret != HG_SUCCESS)
            return(ret);
    }
    return(HG_SUCCESS);
}

static inline hg_return_t hg_proc_bake_target_id_t(hg_proc_t proc, bake_target_id_t *bti)
{
121
122
    /* TODO: make this portable; just raw encoding for now */
    return(hg_proc_raw(proc, bti->id, sizeof(bti->id)));
123
124
}

Philip Carns's avatar
Philip Carns committed
125
126
127
128
129
130
static inline hg_return_t hg_proc_bake_bulk_eager_write_in_t(hg_proc_t proc, bake_bulk_eager_write_in_t *in)
{
    /* TODO: implement */
    return(HG_SUCCESS);
}

131
#endif /* __BAKE_BULK_RPC */