Commit 5fd5b1db authored by Philip Carns's avatar Philip Carns

infrastructure to assign target ids on server side

- using uuids for now
- uuid is persistently associated with pmempool regardless of mercury
  address or storage location
parent 3394c550
Pipeline #978 skipped
......@@ -49,6 +49,12 @@ LIBS="$LIBPMEMOBJ_LIBS $LIBS"
CPPFLAGS="$LIBPMEMOBJ_CFLAGS $CPPFLAGS"
CFLAGS="$LIBPMEMOBJ_CFLAGS $CFLAGS"
PKG_CHECK_MODULES_STATIC([UUID],[uuid],[],
[AC_MSG_ERROR([Could not find working uuid installation!])])
LIBS="$UUID_LIBS $LIBS"
CPPFLAGS="$UUID_CFLAGS $CPPFLAGS"
CFLAGS="$UUID_CFLAGS $CFLAGS"
AC_CONFIG_FILES([Makefile maint/bake-bulk.pc])
AC_OUTPUT
......@@ -12,7 +12,7 @@
/* TODO: this should not be global in the long run; server may provide access
* to multiple targets
*/
extern PMEMobjpool *pmem_pool;
extern PMEMobjpool *g_pmem_pool;
/* definition of internal region_id_t identifier for libpmemobj back end */
typedef struct {
......@@ -73,7 +73,7 @@ static void bake_bulk_create_ult(hg_handle_t handle)
prid = (pmemobj_region_id_t*)out.rid.data;
prid->size = in.region_size;
out.ret = pmemobj_alloc(pmem_pool, &prid->oid, in.region_size, 0, NULL, NULL);
out.ret = pmemobj_alloc(g_pmem_pool, &prid->oid, in.region_size, 0, NULL, NULL);
HG_Free_input(handle, &in);
HG_Respond(handle, NULL, NULL, &out);
......@@ -197,7 +197,7 @@ static void bake_bulk_persist_ult(hg_handle_t handle)
}
/* TODO: should this have an abt shim in case it blocks? */
pmemobj_persist(pmem_pool, buffer, prid->size);
pmemobj_persist(g_pmem_pool, buffer, prid->size);
out.ret = 0;
......
......@@ -7,6 +7,7 @@
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <uuid.h>
#include <abt.h>
#include <abt-snoozer.h>
#include <margo.h>
......@@ -14,10 +15,20 @@
#include "bake-bulk-rpc.h"
struct bake_bulk_root
{
/* TODO: sync up types with bake-bulk.h; for now using uuid directly */
uuid_t target_id;
};
/* TODO: this should not be global in the long run; server may provide access
* to multiple targets
*/
PMEMobjpool *pmem_pool;
/* note that these are deliberately not static for now so we can get to them from
* rpc.c
*/
PMEMobjpool *g_pmem_pool = NULL;
struct bake_bulk_root *g_bake_bulk_root = NULL;
int main(int argc, char **argv)
{
......@@ -27,6 +38,8 @@ int main(int argc, char **argv)
ABT_pool handler_pool;
hg_context_t *hg_context;
hg_class_t *hg_class;
char target_string[64];
PMEMoid root_oid;
if(argc != 3)
{
......@@ -36,13 +49,21 @@ int main(int argc, char **argv)
}
/* open pmem pool */
pmem_pool = pmemobj_open(argv[2], NULL);
if(!pmem_pool)
g_pmem_pool = pmemobj_open(argv[2], NULL);
if(!g_pmem_pool)
{
fprintf(stderr, "pmemobj_open: %s\n", pmemobj_errormsg());
return(-1);
}
/* find root */
root_oid = pmemobj_root(g_pmem_pool, sizeof(*g_bake_bulk_root));
g_bake_bulk_root = pmemobj_direct(root_oid);
if(uuid_is_null(g_bake_bulk_root->target_id))
uuid_generate(g_bake_bulk_root->target_id);
uuid_unparse(g_bake_bulk_root->target_id, target_string);
fprintf(stderr, "BAKE target ID: %s\n", target_string);
/* boilerplate HG initialization steps */
/***************************************/
hg_class = HG_Init(argv[1], HG_TRUE);
......@@ -139,7 +160,7 @@ int main(int argc, char **argv)
HG_Context_destroy(hg_context);
HG_Finalize(hg_class);
pmemobj_close(pmem_pool);
pmemobj_close(g_pmem_pool);
return(0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment