Search documentation of macula

# macula_membership_gossip (macula v0.44.2)

View Source

Gossip dissemination for SWIM protocol. Tracks membership updates and provides them for piggybacking. Uses exponential decay: log(N) messages per update.

# Summary

## Types

gossip_state/0
update/0

## Functions

add_update(State, NodeId, Status, Incarnation)

Add a membership update to gossip. If a more recent update exists, it's replaced.

get_updates(_, MaxUpdates)

Get updates to piggyback on messages. Returns most recent updates first, limited by max_updates.

mark_transmitted(State, NodeId)

Mark an update as transmitted (increment transmit count).

merge_updates(State, ReceivedUpdates)

Merge received gossip updates into local state. Uses SWIM merge semantics (higher incarnation wins, etc.).

new()

Create a new gossip state.

prune(State, TargetTransmitCount)

Prune updates that have been transmitted enough times. Target is typically log(N) where N is cluster size.

# Types

# gossip_state/0

    -type gossip_state() ::
              #{updates =>
                    #{binary() =>
                          {macula_membership_member:status(),
                           non_neg_integer(),
                           non_neg_integer(),
                           integer()}}}.

# update/0

    -type update() :: {binary(), macula_membership_member:status(), non_neg_integer(), non_neg_integer()}.

# Functions

# add_update(State, NodeId, Status, Incarnation)

    -spec add_update(gossip_state(), binary(), macula_membership_member:status(), non_neg_integer()) ->
                        gossip_state().

Add a membership update to gossip. If a more recent update exists, it's replaced.

# get_updates(_, MaxUpdates)

    -spec get_updates(gossip_state(), pos_integer()) -> [update()].

Get updates to piggyback on messages. Returns most recent updates first, limited by max_updates.

# mark_transmitted(State, NodeId)

    -spec mark_transmitted(gossip_state(), binary()) -> gossip_state().

Mark an update as transmitted (increment transmit count).

# merge_updates(State, ReceivedUpdates)

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

Merge received gossip updates into local state. Uses SWIM merge semantics (higher incarnation wins, etc.).

# new()

    -spec new() -> gossip_state().

Create a new gossip state.

# prune(State, TargetTransmitCount)

    -spec prune(gossip_state(), non_neg_integer()) -> gossip_state().

Prune updates that have been transmitted enough times. Target is typically log(N) where N is cluster size.