swim-fd.h 790 Bytes
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

Shane Snyder's avatar
Shane Snyder committed
9 10
#include <stdint.h>
#include <inttypes.h>
11

12 13 14 15 16 17 18
#ifdef __cplusplus
extern "C" {
#endif

/* opaque swim context type */
typedef struct swim_context swim_context_t;

Shane Snyder's avatar
Shane Snyder committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
/* 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 */
35
swim_context_t * swim_init(
Shane Snyder's avatar
Shane Snyder committed
36
    void * group_data,
37 38
    int active);

Shane Snyder's avatar
Shane Snyder committed
39
/* Finalize SWIM */
40
void swim_finalize(
41
    swim_context_t * swim_ctx);
42 43 44 45

#ifdef __cplusplus
}
#endif