Commit a1f37575 authored by Shane Snyder's avatar Shane Snyder
Browse files

expose swim_member_state to SSG

also start removing ssg references from swim code
parent be93f6db
...@@ -47,6 +47,7 @@ typedef struct ssg_member_state ...@@ -47,6 +47,7 @@ typedef struct ssg_member_state
ssg_member_id_t id; ssg_member_id_t id;
char *addr_str; char *addr_str;
hg_addr_t addr; hg_addr_t addr;
swim_member_state_t swim_state;
struct ssg_member_state *next; struct ssg_member_state *next;
UT_hash_handle hh; UT_hash_handle hh;
} ssg_member_state_t; } ssg_member_state_t;
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#pragma once #pragma once
#include <ssg.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -20,17 +18,8 @@ extern "C" { ...@@ -20,17 +18,8 @@ extern "C" {
#define SWIM_MAX_PIGGYBACK_ENTRIES 8 #define SWIM_MAX_PIGGYBACK_ENTRIES 8
#define SWIM_MAX_PIGGYBACK_TX_COUNT 50 #define SWIM_MAX_PIGGYBACK_TX_COUNT 50
typedef uint8_t swim_member_status_t;
typedef uint32_t swim_member_inc_nr_t;
typedef struct swim_member_update swim_member_update_t; typedef struct swim_member_update swim_member_update_t;
enum swim_member_status
{
SWIM_MEMBER_ALIVE = 0,
SWIM_MEMBER_SUSPECT,
SWIM_MEMBER_DEAD
};
struct swim_member_update struct swim_member_update
{ {
ssg_member_id_t id; ssg_member_id_t id;
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include <abt.h> #include <abt.h>
#include <margo.h> #include <margo.h>
#include "ssg.h"
#include "ssg-internal.h"
#include "swim-fd.h" #include "swim-fd.h"
#include "swim-fd-internal.h" #include "swim-fd-internal.h"
...@@ -61,34 +59,24 @@ static int swim_get_rand_group_member_set( ...@@ -61,34 +59,24 @@ static int swim_get_rand_group_member_set(
******************************************************/ ******************************************************/
swim_context_t * swim_init( swim_context_t * swim_init(
ssg_group_t * g, void * group_data,
int active) int active)
{ {
swim_context_t *swim_ctx; swim_context_t *swim_ctx;
int i, ret; int i, ret;
if (g == NULL) return NULL;
/* allocate structure for storing swim context */ /* allocate structure for storing swim context */
swim_ctx = malloc(sizeof(*swim_ctx)); swim_ctx = malloc(sizeof(*swim_ctx));
if (!swim_ctx) return NULL; if (!swim_ctx) return NULL;
memset(swim_ctx, 0, sizeof(*swim_ctx)); memset(swim_ctx, 0, sizeof(*swim_ctx));
#if 0
/* initialize SWIM context */ /* initialize SWIM context */
margo_get_handler_pool(ssg_inst->mid, &swim_ctx->prot_pool); margo_get_handler_pool(ssg_inst->mid, &swim_ctx->prot_pool);
swim_ctx->ping_target = SSG_MEMBER_ID_INVALID; swim_ctx->ping_target = SSG_MEMBER_ID_INVALID;
for(i = 0; i < SWIM_MAX_SUBGROUP_SIZE; i++) for(i = 0; i < SWIM_MAX_SUBGROUP_SIZE; i++)
swim_ctx->subgroup_members[i] = SSG_MEMBER_ID_INVALID; swim_ctx->subgroup_members[i] = SSG_MEMBER_ID_INVALID;
#endif
swim_ctx->member_inc_nrs = malloc(g->view.size *
sizeof(*(swim_ctx->member_inc_nrs)));
if (!swim_ctx->member_inc_nrs)
{
free(swim_ctx);
return NULL;
}
memset(swim_ctx->member_inc_nrs, 0, g->view.size *
sizeof(*(swim_ctx->member_inc_nrs)));
/* set protocol parameters */ /* set protocol parameters */
swim_ctx->prot_period_len = SWIM_DEF_PROTOCOL_PERIOD_LEN; swim_ctx->prot_period_len = SWIM_DEF_PROTOCOL_PERIOD_LEN;
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#pragma once #pragma once
#include "ssg.h" #include <stdint.h>
#include "ssg-internal.h" #include <inttypes.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -16,10 +16,27 @@ extern "C" { ...@@ -16,10 +16,27 @@ extern "C" {
/* opaque swim context type */ /* opaque swim context type */
typedef struct swim_context swim_context_t; typedef struct swim_context swim_context_t;
/* swim member specific types */
typedef uint32_t swim_member_inc_nr_t;
typedef enum swim_member_status
{
SWIM_MEMBER_ALIVE = 0,
SWIM_MEMBER_SUSPECT,
SWIM_MEMBER_DEAD
} swim_member_status_t;
typedef struct swim_member_state
{
swim_member_inc_nr_t inc_nr;
swim_member_status_t status;
} swim_member_state_t;
/* Initialize SWIM */
swim_context_t * swim_init( swim_context_t * swim_init(
ssg_group_t * g, void * group_data,
int active); int active);
/* Finalize SWIM */
void swim_finalize( void swim_finalize(
swim_context_t * swim_ctx); swim_context_t * swim_ctx);
......
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