Search documentation of macula

# macula_membership_detector (macula v0.44.2)

View Source

SWIM failure detector (pure logic, no GenServer). Orchestrates member list, gossip, and protocol timing.

# Summary

## Types

detector_state/0

## Functions

add_member(State, Member)

Add a member to the list.

apply_gossip_updates(State, Updates)

Apply received gossip updates.

get_alive_members(_)

Get all alive members.

get_gossip_updates(_, MaxUpdates)

Get gossip updates to piggyback on messages.

get_member(_, NodeId)

Get a member by node ID.

local_node_id(_)

Get local node ID.

mark_dead(State, NodeId)

Mark a member as dead.

mark_suspect(State, NodeId)

Mark a member as suspect.

new(LocalMember, Config)

Create a new detector state.

protocol_period(_)

Get protocol period.

refute_suspicion(State)

Refute suspicion (increment local incarnation).

select_probe_target(State)

Select a random member to probe (excluding self).

# Types

# detector_state/0

    -type detector_state() ::
              #{local_node_id := binary(),
                protocol_period := pos_integer(),
                indirect_count := pos_integer(),
                suspect_timeout := pos_integer(),
                member_list := macula_membership_list:member_list(),
                gossip := macula_membership_gossip:gossip_state()}.

# Functions

# add_member(State, Member)

    -spec add_member(detector_state(), macula_membership_member:member()) -> detector_state().

Add a member to the list.

# apply_gossip_updates(State, Updates)

    -spec apply_gossip_updates(detector_state(),
                               [{binary(), macula_membership_member:status(), non_neg_integer()}]) ->
                                  detector_state().

Apply received gossip updates.

# get_alive_members(_)

    -spec get_alive_members(detector_state()) -> [macula_membership_member:member()].

Get all alive members.

# get_gossip_updates(_, MaxUpdates)

    -spec get_gossip_updates(detector_state(), pos_integer()) -> [macula_membership_gossip:update()].

Get gossip updates to piggyback on messages.

# get_member(_, NodeId)

    -spec get_member(detector_state(), binary()) -> {ok, macula_membership_member:member()} | not_found.

Get a member by node ID.

# local_node_id(_)

    -spec local_node_id(detector_state()) -> binary().

Get local node ID.

# mark_dead(State, NodeId)

    -spec mark_dead(detector_state(), binary()) -> detector_state().

Mark a member as dead.

# mark_suspect(State, NodeId)

    -spec mark_suspect(detector_state(), binary()) -> detector_state().

Mark a member as suspect.

# new(LocalMember, Config)

    -spec new(macula_membership_member:member(), map()) -> detector_state().

Create a new detector state.

# protocol_period(_)

    -spec protocol_period(detector_state()) -> pos_integer().

Get protocol period.

# refute_suspicion(State)

    -spec refute_suspicion(detector_state()) -> detector_state().

Refute suspicion (increment local incarnation).

# select_probe_target(State)

    -spec select_probe_target(detector_state()) ->
                                 {ok, macula_membership_member:member(), detector_state()} | none.

Select a random member to probe (excluding self).