Commit 6b6d744e authored by Shane Snyder's avatar Shane Snyder

more changes to support multi-mid, multi-group

parent 8af1732e
......@@ -17,7 +17,7 @@
#include <margo.h>
#include "ssg.h"
//#include "swim-fd/swim-fd.h"
#include "swim-fd/swim-fd.h"
#include "uthash.h"
#include "utlist.h"
#include "utarray.h"
......@@ -33,7 +33,7 @@ extern "C" {
#define SSG_DEBUG(__g, __fmt, ...) do { \
double __now = ABT_get_wtime(); \
fprintf(__g->dbg_log, "%.6lf %20"PRIu64" (%s): " __fmt, __now, \
__g->ssg_inst->self_id, __g->name, ## __VA_ARGS__); \
__g->mid_state->self_id, __g->name, ## __VA_ARGS__); \
fflush(__g->dbg_log); \
} while(0)
#else
......@@ -63,6 +63,10 @@ typedef struct ssg_mid_state
hg_id_t join_rpc_id;
hg_id_t leave_rpc_id;
hg_id_t observe_rpc_id;
hg_id_t swim_dping_req_rpc_id;
hg_id_t swim_dping_ack_rpc_id;
hg_id_t swim_iping_req_rpc_id;
hg_id_t swim_iping_ack_rpc_id;
struct ssg_mid_state *next;
} ssg_mid_state_t;
......@@ -77,7 +81,6 @@ typedef struct ssg_group_descriptor
struct ssg_group *g;
struct ssg_observed_group *og;
} g_data;
ssg_mid_state_t *mid_state;
UT_hash_handle hh;
} ssg_group_descriptor_t;
......@@ -93,7 +96,7 @@ typedef struct ssg_member_state
ssg_member_id_t id;
char *addr_str;
hg_addr_t addr;
//swim_member_state_t swim_state;
swim_member_state_t swim_state;
UT_hash_handle hh;
} ssg_member_state_t;
......@@ -104,13 +107,13 @@ typedef struct ssg_group_view
UT_array *rank_array;
} ssg_group_view_t;
/* XXX figure out swim */
typedef struct ssg_group
{
ssg_mid_state_t *mid_state;
char *name;
ssg_group_view_t view;
ssg_member_state_t *dead_members;
//swim_context_t *swim_ctx;
swim_context_t *swim_ctx;
ssg_membership_update_cb update_cb;
void *update_cb_dat;
ABT_rwlock lock;
......@@ -121,6 +124,7 @@ typedef struct ssg_group
typedef struct ssg_observed_group
{
ssg_mid_state_t *mid_state;
char *name;
ssg_group_view_t view;
ABT_rwlock lock;
......@@ -154,14 +158,20 @@ void ssg_register_rpcs(
void ssg_deregister_rpcs(
ssg_mid_state_t *mid_state);
int ssg_group_join_send(
ssg_group_descriptor_t * group_descriptor,
ssg_group_id_t g_id,
const char * target_addr_str,
ssg_mid_state_t * mid_state,
char ** group_name,
int * group_size,
void ** view_buf);
int ssg_group_leave_send(
ssg_group_descriptor_t * group_descriptor);
ssg_group_id_t g_id,
hg_addr_t target_addr,
ssg_mid_state_t * mid_state);
int ssg_group_observe_send(
ssg_group_descriptor_t * group_descriptor,
ssg_group_id_t g_id,
const char * target_addr_str,
ssg_mid_state_t * mid_state,
char ** group_name,
int * group_size,
void ** view_buf);
......
This diff is collapsed.
This diff is collapsed.
#src_libssg_la_SOURCES += \
# src/swim-fd/swim-fd.h \
# src/swim-fd/swim-fd-internal.h \
# src/swim-fd/utlist.h \
# src/swim-fd/swim-fd.c \
# src/swim-fd/swim-fd-ping.c
src_libssg_la_SOURCES += \
src/swim-fd/swim-fd.h \
src/swim-fd/swim-fd-internal.h \
src/swim-fd/utlist.h \
src/swim-fd/swim-fd.c \
src/swim-fd/swim-fd-ping.c
......@@ -43,19 +43,17 @@ typedef struct swim_member_update
/* internal swim context implementation */
struct swim_context
{
margo_instance_id mid;
/* SWIM protocol parameters */
double prot_period_len;
int prot_susp_timeout;
int prot_subgroup_sz;
/* SWIM protocol internal state */
ssg_group_id_t g_id;
swim_member_inc_nr_t self_inc_nr;
ssg_member_id_t dping_target_id;
swim_member_inc_nr_t dping_target_inc_nr;
hg_addr_t dping_target_addr;
double dping_timeout;
ssg_member_id_t iping_target_ids[SWIM_MAX_SUBGROUP_SIZE];
hg_addr_t iping_target_addrs[SWIM_MAX_SUBGROUP_SIZE];
int iping_target_ndx;
int ping_target_acked;
int shutdown_flag;
......@@ -75,8 +73,6 @@ struct swim_context
};
/* SWIM ping function prototypes */
void swim_register_ping_rpcs(
ssg_group_t * group);
void swim_dping_req_send_ult(
void * t_arg);
void swim_iping_req_send_ult(
......
This diff is collapsed.
This diff is collapsed.
......@@ -36,21 +36,38 @@ typedef struct swim_member_state
} swim_member_state_t;
/* forward declarations to work around weird SSG/SWIM circular dependency */
struct ssg_mid_state;
struct ssg_group;
struct ssg_member_state;
struct ssg_member_update;
/**
* Register SWIM RPCs with a given margo instance
*
* @param[in] mid_state mid state structure to register RPCs with
*/
void swim_register_ping_rpcs(
struct ssg_mid_state *mid_state);
/**
* De-register SWIM RPCs with a given margo instance
*
* @param[in] mid_state mid state structure to de-register RPCs with
*/
void swim_deregister_ping_rpcs(
struct ssg_mid_state *mid_state);
/**
* Initialize SWIM protocol for the given SSG group and Margo instance.
*
* @param[in] group pointer to SSG group associated with this SWIM context
* @param[in] mid Margo instance ID
* @param[in] g_id SSG group identifier for group
* @param[in] active boolean value indicating whether member should actively ping
* @returns SSG_SUCCESS on success, SSG_FAILURE otherwise
*/
int swim_init(
struct ssg_group * group,
margo_instance_id mid,
ssg_member_id_t g_id,
int active);
/**
......@@ -62,7 +79,8 @@ void swim_finalize(
struct ssg_group * group);
/**
*
* Applies SSG member updates to SWIM internal state.
*
* @returns SSG_SUCCESS on success, SSG_FAILURE otherwise
*/
int swim_apply_ssg_member_update(
......
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