Commit 644064f8 authored by Shane Snyder's avatar Shane Snyder
Browse files

implement mobject_store_create

MOBJECT_CLUSTER_FILE env variable must be set to point to a
valid file generated by the mobject server.
parent e759a95d
......@@ -7,6 +7,7 @@
#include "mobject-store-config.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <margo.h>
......@@ -14,47 +15,68 @@
#include "libmobject-store.h"
struct mobject_store_handle
typedef struct mobject_store_handle
int test;
ssg_group_id_t gid;
} mobject_store_handle_t;
int mobject_store_create(mobject_store_t *cluster, const char * const id)
struct mobject_store_handle *cluster_handle;
mobject_store_handle_t *cluster_handle;
char *cluster_file;
int ret;
(void)id; /* XXX: id unused in mobject */
/* allocate a new cluster handle and set some fields */
cluster_handle = malloc(sizeof(*cluster_handle));
if (!cluster_handle)
return(-1); /* TODO: error codes */
cluster_handle->test = 123;
/* TODO find the SSG group ID for the mobject cluster group */
return -1;
memset(cluster_handle, 0, sizeof(cluster_handle));
/* use env variable to determine how to connect to the cluster */
/* NOTE: this is the _only_ method for specifying a cluster for now... */
cluster_file = getenv(MOBJECT_CLUSTER_FILE_ENV);
if (!cluster_file)
fprintf(stderr, "Error: %s env variable must point to mobject cluster file\n",
return -1;
ret = ssg_group_id_load(cluster_file, &cluster_handle->gid);
if (ret != 0)
fprintf(stderr, "Error: Unable to load mobject cluster info from file %s\n",
return -1;
/* set the returned cluster handle */
*cluster = cluster_handle;
return 0;
#if 0
int mobject_store_connect(mobject_store_t cluster)
/* TODO ssg attach to mobject cluster group id */
return 0;
void mobject_store_shutdown(mobject_store_t cluster)
struct mobject_store_handle *cluster_handle =
(struct mobject_store_handle *)cluster;
mobject_store_handle_t *cluster_handle =
(mobject_store_handle_t *)cluster;
assert(cluster_handle != NULL);
/* TODO ssg detatch from mobject cluster group id */
/* TODO ssg detatch from mobject cluster group id. free gid? */
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