bake-server.h 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * (C) 2016 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */

#ifndef __BAKE_SERVER_H
#define __BAKE_SERVER_H

#include <margo.h>
#include <libpmemobj.h>
#include "bake.h"

#ifdef __cplusplus
extern "C" {
#endif

18 19 20 21 22 23
#define BAKE_ABT_POOL_DEFAULT ABT_POOL_NULL
#define BAKE_MPLEX_ID_DEFAULT 0
#define BAKE_PROVIDER_IGNORE NULL

typedef struct bake_server_context_t* bake_provider_t;

24 25 26 27
/**
 * Creates a BAKE pool to use for backend PMEM storage.
 * 
 * NOTE: This function must be called on a pool before the pool
28
 * can be passed to 'bake_provider_register'.
29 30 31 32 33 34
 *
 * @param[in] pool_name path to PMEM backend file
 * @param[in] pool_size size of the created pool
 * @param[in] pool_mode mode of the created pool
 * @returns 0 on success, -1 otherwise
 */
35
int bake_makepool(
36 37 38 39 40 41 42 43
    const char *pool_name,
    size_t pool_size,
    mode_t pool_mode);

/**
 * Initializes a BAKE server instance.
 *
 * @param[in] mid Margo instance identifier
44 45
 * @param[in] mplex_id Multiplex id
 * @param[in] pool Pool on which to run the RPC handlers
46
 * @param[in] pool_name path to PMEM backend file
47
 * @param[out] provider resulting provider
48 49
 * @returns 0 on success, -1 otherwise
 */
50
int bake_provider_register(
51
    margo_instance_id mid,
52 53 54 55
    uint32_t mplex_id,
    ABT_pool pool,
    const char *pool_name,
    bake_provider_t* provider);
56 57 58 59 60 61

#ifdef __cplusplus
}
#endif

#endif /* __BAKE_SERVER_H */