bake-provider.h 1.86 KB
Newer Older
1
2
/*
 * (C) 2015 The University of Chicago
Philip Carns's avatar
Philip Carns committed
3
 *
4
5
6
7
8
9
10
11
12
13
14
15
16
 * See COPYRIGHT in top-level directory.
 */
#ifndef __BAKE_PROVIDER_H
#define __BAKE_PROVIDER_H

#include "bake-config.h"

#include <libpmemobj.h>
#include <unistd.h>
#include <fcntl.h>
#include <margo.h>
#include <margo-bulk-pool.h>
#ifdef USE_REMI
Philip Carns's avatar
Philip Carns committed
17
18
    #include <remi/remi-client.h>
    #include <remi/remi-server.h>
19
20
21
22
23
#endif
#include "bake-server.h"
#include "bake-backend.h"
#include "uthash.h"

Philip Carns's avatar
Philip Carns committed
24
25
typedef struct {
    bake_target_id_t  target_id;
26
    backend_context_t context;
Philip Carns's avatar
Philip Carns committed
27
28
    bake_backend_t    backend;
    UT_hash_handle    hh;
29
30
} bake_target_t;

Philip Carns's avatar
Philip Carns committed
31
typedef struct bake_provider {
32
    margo_instance_id mid;
Philip Carns's avatar
Philip Carns committed
33
    ABT_pool   handler_pool; // pool used to run RPC handlers for this provider
34
35
36
    ABT_rwlock lock; // write-locked during migration, read-locked by all other
    // operations. There should be something better to avoid locking everything
    // but we are going with that for simplicity for now.
Philip Carns's avatar
Philip Carns committed
37
    uint64_t       num_targets;
38
    bake_target_t* targets;
39
40
    abt_io_instance_id
        aid; /* externally provided abt-io instance, if present */
Philip Carns's avatar
Philip Carns committed
41
42
    hg_id_t
        bake_create_write_persist_id; // <-- this is a client version of the id
43
44

#ifdef USE_REMI
Philip Carns's avatar
Philip Carns committed
45
    remi_client_t   remi_client;
46
47
48
    remi_provider_t remi_provider;
#endif

49
    margo_bulk_poolset_t poolset; /* intermediate buffers, if used */
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

    // list of RPC ids
    hg_id_t rpc_create_id;
    hg_id_t rpc_write_id;
    hg_id_t rpc_eager_write_id;
    hg_id_t rpc_persist_id;
    hg_id_t rpc_create_write_persist_id;
    hg_id_t rpc_eager_create_write_persist_id;
    hg_id_t rpc_get_size_id;
    hg_id_t rpc_get_data_id;
    hg_id_t rpc_read_id;
    hg_id_t rpc_eager_read_id;
    hg_id_t rpc_probe_id;
    hg_id_t rpc_noop_id;
    hg_id_t rpc_remove_id;
    hg_id_t rpc_migrate_region_id;
    hg_id_t rpc_migrate_target_id;

68
69
    struct json_object* json_cfg;

70
71
72
} bake_provider;

#endif