swim-fd-internal.h 2 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 11 12 13 14 15 16 17 18 19 20 21

#ifdef __cplusplus
extern "C" {
#endif

#include <ssg.h>

#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

Shane Snyder's avatar
Shane Snyder committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
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;
};
40

41 42 43 44 45 46
/* 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
47 48
    swim_member_id_t ping_target;
    swim_member_inc_nr_t ping_target_inc_nr;
49 50
    int ping_target_acked;
    double dping_timeout;
Shane Snyder's avatar
Shane Snyder committed
51
    swim_member_id_t subgroup_members[SWIM_MAX_SUBGROUP_SIZE];
52 53
    int shutdown_flag;
    /* current membership state */
Shane Snyder's avatar
Shane Snyder committed
54
    swim_member_inc_nr_t *member_inc_nrs;
55 56 57 58 59 60 61 62 63 64
    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
65
/* SWIM ping function prototypes */
66
void swim_register_ping_rpcs(
67
    ssg_t s);
68 69 70 71 72
void swim_dping_send_ult(
    void *t_arg);
void swim_iping_send_ult(
    void *t_arg);

Shane Snyder's avatar
Shane Snyder committed
73 74 75 76 77 78 79 80 81 82
/* SWIM membership update function prototypes */
void swim_retrieve_membership_updates(
    ssg_t s,
    swim_member_update_t *updates,
    int update_count);
void swim_apply_membership_updates(
    ssg_t s,
    swim_member_update_t *updates,
    int update_count);

83 84 85
#ifdef __cplusplus
}
#endif