partisan_full_membership_strategy (partisan v5.0.2)

View Source

This module implements the full-mesh membership strategy to be used with {link partisan_pluggable_peer_service_manager}.

Summary

Functions

Returns the tuple {Joiners, Leavers} where Joiners is the list of node specifications that are elements of List but are not in the membership set, and Leavers are the node specifications for the current members that are not elements in List.

Handling incoming protocol message.

Initialize the strategy state.

When a node is connected, return the state, membership and outgoing message queue to be transmitted.

Leave a node from the cluster.

Periodic protocol maintenance.

Types

membership_list/0

-type membership_list() :: partisan_membership_strategy:membership_list().

outgoing_messages/0

-type outgoing_messages() :: partisan_membership_strategy:outgoing_messages().

t/0

-type t() :: #full_v1{actor :: partisan:actor(), membership :: partisan_membership_set:t()}.

Functions

compare(Members, State)

-spec compare(Members :: [partisan:node_spec()], t()) ->
                 {Joiners :: [partisan:node_spec()], Leavers :: [partisan:node_spec()]}.

Returns the tuple {Joiners, Leavers} where Joiners is the list of node specifications that are elements of List but are not in the membership set, and Leavers are the node specifications for the current members that are not elements in List.

handle_message(_, State)

-spec handle_message(partisan:message(), State :: any()) ->
                        {ok, membership_list(), outgoing_messages(), NewState :: any()}.

Handling incoming protocol message.

init(Actor)

-spec init(partisan:actor()) -> {ok, membership_list(), State :: any()}.

Initialize the strategy state.

join(Node, PeerState, State)

-spec join(partisan:node_spec(), PeerState :: any(), State :: any()) ->
              {ok, membership_list(), outgoing_messages(), NewState :: any()}.

When a node is connected, return the state, membership and outgoing message queue to be transmitted.

leave(_, State)

-spec leave(partisan:node_spec(), State :: any()) ->
               {ok, membership_list(), outgoing_messages(), NewState :: any()}.

Leave a node from the cluster.

periodic(State)

-spec periodic(State :: any()) -> {ok, membership_list(), outgoing_messages(), NewState :: any()}.

Periodic protocol maintenance.

prune(T, State)

-spec prune([partisan:node_spec()], State :: any()) -> {ok, membership_list(), NewState :: any()}.