Commit 72afe222 authored by Shane Snyder's avatar Shane Snyder

port swim module over to new interface changes

parent dcd3fc52
......@@ -17,10 +17,7 @@ extern "C" {
#include <abt.h>
#include <margo.h>
#include <ssg.h>
#if USE_SWIM_FD
#include "swim-fd/swim-fd.h"
#endif
#include "ssg.h"
/* debug printing macro for SSG */
/* TODO: direct debug output to file? */
......@@ -58,11 +55,12 @@ struct ssg_group
ssg_group_id_t id;
int self_rank;
ssg_group_view_t view;
#if USE_SWIM_FD
swim_context_t *swim_ctx;
#endif
void *fd_ctx; /* failure detector context (currently just SWIM) */
};
/* XXX: is this right? can this be a global? */
extern margo_instance_id ssg_mid;
#ifdef __cplusplus
}
#endif
......@@ -4,7 +4,7 @@
* See COPYRIGHT in top-level directory.
*/
#include <ssg-config.h>
#include "ssg-config.h"
#include <sys/types.h>
#include <sys/stat.h>
......@@ -19,7 +19,7 @@
#include <abt.h>
#include <margo.h>
#include <ssg.h>
#include "ssg.h"
#include "ssg-internal.h"
#if USE_SWIM_FD
#include "swim-fd/swim-fd.h"
......@@ -32,7 +32,7 @@ static const char ** ssg_setup_addr_str_list(
char * buf, int num_addrs);
/* XXX: is this right? can this be a global? */
static margo_instance_id ssg_mid = MARGO_INSTANCE_NULL;
margo_instance_id ssg_mid = MARGO_INSTANCE_NULL;
/***************************************************
*** SSG runtime intialization/shutdown routines ***
......@@ -145,24 +145,18 @@ ssg_group_id_t ssg_group_create(
}
SSG_DEBUG(g, "group lookup successful (size=%d)\n", group_size);
#if 0
#if USE_SWIM_FD
// initialize swim failure detector
/* initialize swim failure detector */
// TODO: we should probably barrier or sync somehow to avoid rpc failures
// due to timing skew of different ranks initializing swim
s->swim_ctx = swim_init(s, 1);
if (s->swim_ctx == NULL)
{
ssg_finalize(s);
s = NULL;
}
#endif
g->fd_ctx = (void *)swim_init(g, 1);
if (g->fd_ctx == NULL) goto fini;
#endif
/* TODO: last step => add reference to this group to SSG runtime state */
/* don't free these pointers on success */
//self_addr = HG_ADDR_NULL; /* TODO: free this in ssg_group_destroy */
self_addr = HG_ADDR_NULL; /* TODO: free this in ssg_group_destroy */
g = NULL;
fini:
if (hgcl && self_addr != HG_ADDR_NULL) HG_Addr_free(hgcl, self_addr);
......
......@@ -12,6 +12,7 @@ extern "C" {
#include <ssg.h>
/* SWIM protocol parameter defaults */
#define SWIM_DEF_PROTOCOL_PERIOD_LEN 2000.0 /* milliseconds */
#define SWIM_DEF_SUSPECT_TIMEOUT 5 /* protocol period lengths */
#define SWIM_DEF_SUBGROUP_SIZE 2
......@@ -19,6 +20,8 @@ extern "C" {
#define SWIM_MAX_PIGGYBACK_ENTRIES 8
#define SWIM_MAX_PIGGYBACK_TX_COUNT 50
#define SWIM_MEMBER_RANK_UNKNOWN (-1)
typedef int64_t swim_member_id_t;
typedef uint8_t swim_member_status_t;
typedef uint32_t swim_member_inc_nr_t;
......@@ -64,21 +67,23 @@ struct swim_context
/* SWIM ping function prototypes */
void swim_register_ping_rpcs(
ssg_t s);
ssg_group_t *g);
void swim_dping_send_ult(
void *t_arg);
void swim_iping_send_ult(
void *t_arg);
#if 0
/* SWIM membership update function prototypes */
void swim_retrieve_membership_updates(
ssg_t s,
ssg_group_t *g,
swim_member_update_t *updates,
int update_count);
void swim_apply_membership_updates(
ssg_t s,
ssg_group_t *g,
swim_member_update_t *updates,
int update_count);
#endif
#ifdef __cplusplus
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -10,13 +10,14 @@
extern "C" {
#endif
#include <ssg.h>
#include "ssg.h"
#include "ssg-internal.h"
/* opaque swim context type */
typedef struct swim_context swim_context_t;
swim_context_t *swim_init(
ssg_t s,
ssg_group_t *g,
int active);
void swim_finalize(
......
......@@ -135,8 +135,8 @@ int main(int argc, char *argv[])
if (sleep_time > 0) margo_thread_sleep(mid, sleep_time *1000.0);
cleanup:
/* cleanup */
/** cleanup **/
ssg_group_destroy(g_id);
ssg_finalize();
......
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