Commit f32d4194 authored by Shane Snyder's avatar Shane Snyder

return group_config in join operations

parent 1c5f059b
......@@ -37,9 +37,9 @@ typedef uint64_t ssg_member_id_t;
typedef struct ssg_group_config
{
int swim_period_length_ms; /* period length in miliseconds */
int swim_suspect_timeout_periods; /* suspicion timeout in periods */
int swim_subgroup_member_count; /* iping subgroup count */
int32_t swim_period_length_ms; /* period length in miliseconds */
int32_t swim_suspect_timeout_periods; /* suspicion timeout in periods */
int32_t swim_subgroup_member_count; /* iping subgroup count */
} ssg_group_config_t;
/* initializer macro to ensure SSG ignores unset config params */
......
......@@ -112,6 +112,7 @@ typedef struct ssg_group
ssg_mid_state_t *mid_state;
char *name;
ssg_group_view_t view;
ssg_group_config_t config;
ssg_member_state_t *dead_members;
swim_context_t *swim_ctx;
ssg_membership_update_cb update_cb;
......@@ -162,7 +163,8 @@ int ssg_group_join_send(
const char * target_addr_str,
ssg_mid_state_t * mid_state,
char ** group_name,
int * group_size,
int * group_size,
ssg_group_config_t * group_config,
void ** view_buf);
int ssg_group_leave_send(
ssg_group_id_t g_id,
......
......@@ -22,15 +22,21 @@
/* TODO join and observe are nearly identical -- refactor */
MERCURY_GEN_STRUCT_PROC(ssg_group_config_t, \
((int32_t) (swim_period_length_ms))
((int32_t) (swim_suspect_timeout_periods))
((int32_t) (swim_subgroup_member_count)));
MERCURY_GEN_PROC(ssg_group_join_request_t, \
((ssg_group_id_t) (g_id))
((hg_string_t) (addr_str))
((hg_bulk_t) (bulk_handle)));
MERCURY_GEN_PROC(ssg_group_join_response_t, \
((hg_string_t) (group_name)) \
((uint32_t) (group_size)) \
((hg_size_t) (view_buf_size))
((uint8_t) (ret)));
((hg_string_t) (group_name))
((uint32_t) (group_size))
((ssg_group_config_t) (group_config))
((hg_size_t) (view_buf_size))
((uint8_t) (ret)));
MERCURY_GEN_PROC(ssg_group_leave_request_t, \
((ssg_group_id_t) (g_id)) \
......@@ -110,6 +116,7 @@ int ssg_group_join_send(
ssg_mid_state_t * mid_state,
char ** group_name,
int * group_size,
ssg_group_config_t * group_config,
void ** view_buf)
{
hg_addr_t group_target_addr;
......@@ -199,6 +206,7 @@ int ssg_group_join_send(
*group_name = strdup(join_resp.group_name);
*group_size = (int)join_resp.group_size;
*view_buf = tmp_view_buf;
memcpy(group_config, &join_resp.group_config, sizeof(*group_config));
sret = join_resp.ret;
margo_free_output(handle, &join_resp);
......@@ -300,6 +308,8 @@ static void ssg_group_join_recv_ult(
/* set the response and send back */
join_resp.group_name = g_desc->g_data.g->name;
join_resp.group_size = (int)g_desc->g_data.g->view.size;
memcpy(&join_resp.group_config, &g_desc->g_data.g->config,
sizeof(join_resp.group_config));
join_resp.view_buf_size = view_buf_size;
join_resp.ret = SSG_SUCCESS;
fini:
......
......@@ -578,6 +578,7 @@ int ssg_group_join(
ssg_group_descriptor_t *g_desc;
char *group_name = NULL;
int group_size;
ssg_group_config_t group_config;
void *view_buf = NULL;
const char **addr_strs = NULL;
ssg_group_id_t create_g_id;
......@@ -618,7 +619,7 @@ int ssg_group_join(
if(!mid_state) goto fini;
sret = ssg_group_join_send(group_id, g_desc->addr_str, mid_state,
&group_name, &group_size, &view_buf);
&group_name, &group_size, &group_config, &view_buf);
if (sret != SSG_SUCCESS || !group_name || !view_buf) goto fini;
/* free old descriptor */
......@@ -633,9 +634,8 @@ int ssg_group_join(
if(!addr_strs) goto fini;
addr_strs[group_size++] = mid_state->self_addr_str;
/* XXX how to config group? */
create_g_id = ssg_group_create_internal(mid_state, group_name, addr_strs, group_size,
NULL, update_cb, update_cb_dat);
&group_config, update_cb, update_cb_dat);
if (create_g_id != SSG_GROUP_ID_INVALID)
{
......@@ -1580,9 +1580,12 @@ static ssg_group_id_t ssg_group_create_internal(
ssg_group_descriptor_t *g_desc = NULL, *g_desc_check;
ssg_group_id_t g_id;
ssg_group_t *g;
ssg_group_config_t tmp_group_conf = SSG_GROUP_CONFIG_INITIALIZER;
int success = 0;
int sret;
if (!group_conf) group_conf = &tmp_group_conf;
/* allocate an SSG group data structure and initialize some of it */
g = malloc(sizeof(*g));
if (!g) goto fini;
......@@ -1590,6 +1593,7 @@ static ssg_group_id_t ssg_group_create_internal(
g->mid_state = mid_state;
g->name = strdup(group_name);
if (!g->name) goto fini;
memcpy(&g->config, group_conf, sizeof(*group_conf));
g->update_cb = update_cb;
g->update_cb_dat = update_cb_dat;
ABT_rwlock_create(&g->lock);
......
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