Search documentation of macula

# macula_membership_member (macula v0.44.2)

View Source

Member record and state transitions for SWIM protocol. Represents a single node in the membership list.

# Summary

## Types

member/0
status/0

## Functions

address(_)

Get address.

compare(_, _)

Compare two members to determine which is more recent. Returns: gt (M1 is newer), lt (M1 is older), eq (same)

incarnation(_)

Get incarnation number.

mark_alive(Member, NewIncarnation)

Mark member as alive with new incarnation (refutation). Dead members cannot be revived.

mark_dead(Member)

Mark member as dead (confirmed failure).

mark_suspect(Member)

Mark member as suspect (failed to respond to ping).

merge(M1, M2)

Merge two member states, keeping the most recent information. Rules: 1. Dead always wins 2. Higher incarnation wins 3. Same incarnation: suspect > alive

metadata(_)

Get metadata.

new(NodeId, Address)

Create a new member with alive status and incarnation 0.

new(NodeId, Address, Metadata)

Create a new member with custom metadata.

node_id(_)

Get node ID.

status(_)

Get status.

# Types

# member/0

    -type member() ::
              #{node_id := binary(),
                address := {inet:ip_address(), inet:port_number()},
                status := status(),
                incarnation := non_neg_integer(),
                metadata := map()}.

# status/0

    -type status() :: alive | suspect | dead.

# Functions

# address(_)

    -spec address(member()) -> {inet:ip_address(), inet:port_number()}.

Get address.

# compare(_, _)

    -spec compare(member(), member()) -> gt | lt | eq.

Compare two members to determine which is more recent. Returns: gt (M1 is newer), lt (M1 is older), eq (same)

# incarnation(_)

    -spec incarnation(member()) -> non_neg_integer().

Get incarnation number.

# mark_alive(Member, NewIncarnation)

    -spec mark_alive(member(), non_neg_integer()) -> member().

Mark member as alive with new incarnation (refutation). Dead members cannot be revived.

# mark_dead(Member)

    -spec mark_dead(member()) -> member().

Mark member as dead (confirmed failure).

# mark_suspect(Member)

    -spec mark_suspect(member()) -> member().

Mark member as suspect (failed to respond to ping).

# merge(M1, M2)

    -spec merge(member(), member()) -> member().

Merge two member states, keeping the most recent information. Rules: 1. Dead always wins 2. Higher incarnation wins 3. Same incarnation: suspect > alive

# metadata(_)

    -spec metadata(member()) -> map().

Get metadata.

# new(NodeId, Address)

    -spec new(binary(), {inet:ip_address(), inet:port_number()}) -> member().

Create a new member with alive status and incarnation 0.

# new(NodeId, Address, Metadata)

    -spec new(binary(), {inet:ip_address(), inet:port_number()}, map()) -> member().

Create a new member with custom metadata.

# node_id(_)

    -spec node_id(member()) -> binary().

Get node ID.

# status(_)

    -spec status(member()) -> status().

Get status.