swim-fd-internal.h 2.09 KB
Newer Older
1
/*
Shane Snyder's avatar
Shane Snyder committed
2 3
 * Copyright (c) 2016 UChicago Argonne, LLC
 *
4 5 6
 * See COPYRIGHT in top-level directory.
 */

Shane Snyder's avatar
Shane Snyder committed
7
#pragma once
8

9 10
#include <ssg.h>

11 12 13 14
#ifdef __cplusplus
extern "C" {
#endif

15
/* SWIM protocol parameter defaults */
16 17 18 19 20 21 22
#define SWIM_DEF_PROTOCOL_PERIOD_LEN    2000.0  /* milliseconds */
#define SWIM_DEF_SUSPECT_TIMEOUT        5       /* protocol period lengths */
#define SWIM_DEF_SUBGROUP_SIZE          2
#define SWIM_MAX_SUBGROUP_SIZE          5
#define SWIM_MAX_PIGGYBACK_ENTRIES      8
#define SWIM_MAX_PIGGYBACK_TX_COUNT     50

23 24
#define SWIM_MEMBER_RANK_UNKNOWN (-1)

Shane Snyder's avatar
Shane Snyder committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
typedef int64_t swim_member_id_t;
typedef uint8_t swim_member_status_t;
typedef uint32_t swim_member_inc_nr_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
{
    swim_member_id_t id;
    swim_member_status_t status;
    swim_member_inc_nr_t inc_nr;
};
43

44 45 46 47 48 49
/* internal swim context implementation */
struct swim_context
{
    /* argobots pool for launching SWIM threads */
    ABT_pool prot_pool;
    /* SWIM internal state */
Shane Snyder's avatar
Shane Snyder committed
50 51
    swim_member_id_t ping_target;
    swim_member_inc_nr_t ping_target_inc_nr;
52 53
    int ping_target_acked;
    double dping_timeout;
Shane Snyder's avatar
Shane Snyder committed
54
    swim_member_id_t subgroup_members[SWIM_MAX_SUBGROUP_SIZE];
55 56
    int shutdown_flag;
    /* current membership state */
Shane Snyder's avatar
Shane Snyder committed
57
    swim_member_inc_nr_t *member_inc_nrs;
58 59 60 61 62 63 64 65 66 67
    void *suspect_list;
    void *recent_update_list;
    /* SWIM protocol parameters */
    double prot_period_len;
    int prot_susp_timeout;
    int prot_subgroup_sz;
    /* swim protocol ULT handle */
    ABT_thread prot_thread;
};

Shane Snyder's avatar
Shane Snyder committed
68
/* SWIM ping function prototypes */
69
void swim_register_ping_rpcs(
70
    ssg_group_t *g);
71 72 73 74 75
void swim_dping_send_ult(
    void *t_arg);
void swim_iping_send_ult(
    void *t_arg);

Shane Snyder's avatar
Shane Snyder committed
76 77
/* SWIM membership update function prototypes */
void swim_retrieve_membership_updates(
78
    ssg_group_t *g,
Shane Snyder's avatar
Shane Snyder committed
79 80 81
    swim_member_update_t *updates,
    int update_count);
void swim_apply_membership_updates(
82
    ssg_group_t *g,
Shane Snyder's avatar
Shane Snyder committed
83 84 85
    swim_member_update_t *updates,
    int update_count);

86 87 88
#ifdef __cplusplus
}
#endif