View Source partisan_pluggable_peer_service_manager (partisan v5.0.0-rc.8)

This module realises the partisan_peer_service_manager behaviour implementing a peer sampling service with a pluggable overlay topology by delegating the topology definition to a callback module implementing the {partisan_peer_service_strategy} behaviour.

Characteristics

  • Uses TCP/IP.
  • All nodes communicate and maintain connections with all other nodes.
  • Nodes periodically send heartbeat messages. The service considers a node "failed" when it misses X heartbeats.
  • Point-to-point messaging with a single network hop.
  • Eventually consistent membership maintained in a CRDT and replicated using gossip.
  • Scalability limited to hundres of nodes (60-200 nodes).

Summary

Functions

Cast a message to a remote gen_server.
Cast a message to a remote gen_server.
Decode state.
Gensym support for forwarding.
Gensym support for forwarding.
Forward message to registered process on the remote side.
Return local node's view of cluster membership.
Inject a partition.
Attempt to join a remote node.
Leave the cluster.
Remove another node from the cluster.
Returns true if node Node is a member in the membership list. Otherwise returns false.
Return membership list.
Return membership list.
Trigger function on connection close for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Trigger function on connection close for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Trigger function on connection open for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Trigger function on connection open for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Return partitions.
Receive message from a remote manager.
Reserve a slot for the particular tag.
Resolve a partition.
Send message to a remote peer service manager.
Same as start_link([]).
Attempt to join a remote node.
Update membership.

Types

-type channel_subs() :: #{{'_' | node(), partisan:channel()} => on_event_fun()}.
-type from() :: {pid(), atom()}.
-type info() ::
    connections | retransmit | periodic | instrumentation | distance | tree_refresh |
    {'EXIT', partisan:any_pid(), any()} |
    {connected, partisan:node_spec(), partisan:channel(), tag(), t()}.
-type interpos_arg() :: {receive_message, node(), any()} | {forward_message, node(), any()}.
-type interpos_fun() :: fun((interpos_arg()) -> interpos_arg()).
-type interposition_map(T) :: #{any() => T}.
-type node_subs() :: #{'_' | node() => on_event_fun()}.
-type on_event_fun() :: partisan_peer_service_manager:on_event_fun().
-type t() :: #state{}.
-type tag() :: atom().
-type x_interpos_fun() :: fun((interpos_arg()) -> ok).

Functions

Link to this function

add_interposition_fun(Name, InterpositionFun)

View Source
-spec add_interposition_fun(any(), interpos_fun()) -> ok.
Link to this function

add_post_interposition_fun(Name, PostInterpositionFun)

View Source
-spec add_post_interposition_fun(any(), x_interpos_fun()) -> ok.
Link to this function

add_pre_interposition_fun(Name, Fun)

View Source
-spec add_pre_interposition_fun(any(), x_interpos_fun()) -> ok.
Link to this function

cast_message(Term, Message)

View Source
-spec cast_message(Term :: partisan:any_pid() | partisan:any_name(), Message :: partisan:message()) ->
                ok.
Link to this function

cast_message(Node, ServerRef, Message)

View Source
Cast a message to a remote gen_server.
Link to this function

cast_message(Node, ServerRef, Message, Options)

View Source
Cast a message to a remote gen_server.
Link to this function

code_change(OldVsn, State, Extra)

View Source
-spec code_change(term() | {down, term()}, t(), term()) -> {ok, t()}.
Decode state.
Link to this function

forward_message(Term, Message)

View Source
Gensym support for forwarding.
Link to this function

forward_message(PidOrName, Message, Opts)

View Source
Gensym support for forwarding.
Link to this function

forward_message(Node, ServerRef, Message, Opts)

View Source
Forward message to registered process on the remote side.
Link to this function

get_interposition_funs()

View Source
-spec get_interposition_funs() -> interposition_map(interpos_fun()).
Return local node's view of cluster membership.
Link to this function

get_pre_interposition_funs()

View Source
-spec get_pre_interposition_funs() -> interposition_map(x_interpos_fun()).
Link to this function

handle_call(Event, From, State)

View Source
Link to this function

handle_cast(Event, State)

View Source
-spec handle_cast(term(), t()) -> {noreply, t()} | {stop, normal, t()}.
-spec handle_info(info(), t()) -> {noreply, t()}.
-spec init([]) -> {ok, t()}.
Link to this function

inject_partition(Origin, TTL)

View Source
Inject a partition.
Attempt to join a remote node.
Leave the cluster.
Remove another node from the cluster.
Link to this function

maybe_reply_sync_joins(State)

View Source
Returns true if node Node is a member in the membership list. Otherwise returns false.
Return membership list.
Link to this function

members_for_orchestration()

View Source
Return membership list.
Trigger function on connection close for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Link to this function

on_down(Node, Fun, Opts)

View Source
Trigger function on connection close for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Trigger function on connection open for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Trigger function on connection open for a given node. Fun is a function object taking zero or a single argument, where the argument is the Node name.
Return partitions.
Link to this function

receive_message(Node, Channel, Cmd)

View Source
Receive message from a remote manager.
Link to this function

remove_interposition_fun(Name)

View Source
-spec remove_interposition_fun(any()) -> ok.
Link to this function

remove_post_interposition_fun(Name)

View Source
-spec remove_post_interposition_fun(any()) -> ok.
Link to this function

remove_pre_interposition_fun(Name)

View Source
-spec remove_pre_interposition_fun(any()) -> ok.
Reserve a slot for the particular tag.
Link to this function

resolve_partition(Reference)

View Source
Resolve a partition.
Link to this function

send_message(Node, Message)

View Source
Send message to a remote peer service manager.
-spec start_link() -> {ok, pid()} | ignore | {error, term()}.
Same as start_link([]).
Link to this function

supports_capability(Arg)

View Source
-spec supports_capability(Arg :: atom()) -> boolean().
Attempt to join a remote node.
Link to this function

terminate(Reason, State)

View Source
-spec terminate(term(), t()) -> term().
Update membership.