partisan_full_membership_strategy (partisan v5.0.1)
View SourceThis 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
-type membership_list() :: partisan_membership_strategy:membership_list().
-type outgoing_messages() :: partisan_membership_strategy:outgoing_messages().
-type t() :: #full_v1{actor :: partisan:actor(), membership :: partisan_membership_set:t()}.
Functions
-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
.
-spec handle_message(partisan:message(), State :: any()) -> {ok, membership_list(), outgoing_messages(), NewState :: any()}.
Handling incoming protocol message.
-spec init(partisan:actor()) -> {ok, membership_list(), State :: any()}.
Initialize the strategy 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.
-spec leave(partisan:node_spec(), State :: any()) -> {ok, membership_list(), outgoing_messages(), NewState :: any()}.
Leave a node from the cluster.
-spec periodic(State :: any()) -> {ok, membership_list(), outgoing_messages(), NewState :: any()}.
Periodic protocol maintenance.
-spec prune([partisan:node_spec()], State :: any()) -> {ok, membership_list(), NewState :: any()}.