View Source partisan_peer_connections (partisan v5.0.0-rc.8)
Summary
Functions
Returns the channel name of the connection
Finds connection for a node.
Finds connection for a node.
Finds connection for a node and channel.
Finds connection for a node and channel.
Returns the number of connections for node Node
.
Returns the nbr of connections for node
Node
and channel Channel
.Return a pid to use for message dispatch.
Return a pid to use for message dispatch.
Return a
{ok, Pid}
where Pid
is the connection pid to use for message dispatch. If channel Channel
is disconnected it falls back to a default channel connection if one exists. If no connections exist returns {error, disconnected}
.Returns a tuple
{ok, Value}
, where Value
is an instance of info()
associated with Node
, or error
if no info is associated with Node
.Creates a new connections table. The owner of the table is the calling process and the table is protected so only the owner can write to it.
Returns true is this node is connected to
NodeOrName
. If Node
is this node, returns true
.Returns true is this node is connected to
NodeOrName
. If Node
is this node, returns true
.Returns true is this node has all the requested connections (
parallelism
configuration parameter) for all the configured channels with node NodeOrSpec
.Returns a list of all nodes specifications connected to this node.
Returns a list of all nodes connected to this node through normal connections (that is, hidden nodes are not listed).
Returns the pids for all the active connection for a node.
Returns the pids for all the active connection for a node and channel.
Prune all occurrences of a connection pid returns the node where the pruned pid was found
Store a connection
Types
-type connection() :: #partisan_peer_connection{}.
-type connections() :: [connection()].
-type info() :: #partisan_peer_info{}.
-type maybe_var(T) :: T | var().
-type optional(T) :: T | undefined.
-type var() :: '_' | '$1' | '$2' | '$3'.
Functions
-spec channel(connection()) -> partisan:channel().
-spec connections() -> connections().
-spec connections(NodeOrSpec :: atom() | partisan:node_spec()) -> connections().
-spec connections(NodeOrSpec :: maybe_var(atom() | partisan:node_spec()), Channels :: maybe_var(partisan:channel() | [partisan:channel()])) -> connections() | no_return().
-spec connections(NodeOrSpec :: maybe_var(atom() | partisan:node_spec()), Channels :: maybe_var(partisan:channel() | [partisan:channel()]), ListenAddr :: partisan:listen_addr()) -> connections() | no_return().
-spec count() -> non_neg_integer().
-spec count(Arg :: partisan:node_spec() | node() | info()) -> non_neg_integer().
Returns the number of connections for node Node
.
partisan:node_spec/0
as Arg
it is equivalent to calling connection_count/2
with a wildcard as a second argument i.e. '_'. However, when passed a node()` as `Arg
is uses the more efficient ets` `lookup_element
operation.
-spec count(NodeOrSpec :: maybe_var(partisan:node_spec() | node()), Channels :: maybe_var(partisan:channel() | [partisan:channel()])) -> non_neg_integer() | no_return().
Node
and channel Channel
.
-spec count(Node :: maybe_var(node() | partisan:node_spec()), Channels :: maybe_var(partisan:channel() | [partisan:channel()]), ListenAddr :: partisan:listen_addr()) -> Count :: non_neg_integer().
-spec dispatch(any()) -> ok | {error, disconnected | not_yet_connected}.
-spec dispatch_pid(node() | partisan:node_spec()) -> {ok, pid()} | {error, disconnected | not_yet_connected | notalive}.
-spec dispatch_pid(Node :: node() | partisan:node_spec(), Channel :: partisan:channel()) -> {ok, pid()} | {error, disconnected | not_yet_connected | notalive} | no_return().
-spec dispatch_pid(Node :: node() | partisan:node_spec(), Channel :: partisan:channel(), PartitionKey :: optional(any())) -> {ok, pid()} | {error, disconnected | not_yet_connected | notalive} | no_return().
{ok, Pid}
where Pid
is the connection pid to use for message dispatch. If channel Channel
is disconnected it falls back to a default channel connection if one exists. If no connections exist returns {error, disconnected}
.
-spec erase(pid() | node() | partisan:node_spec()) -> ok.
-spec fold(Fun :: fun((partisan:node_spec(), connections(), Acc1 :: any()) -> Acc2 :: any()), AccIn :: any()) -> AccOut :: any().
-spec foreach(Fun :: fun((info(), connections()) -> ok)) -> ok.
-spec info(NodeOrSpec :: partisan:node_spec() | node()) -> {ok, info()} | error.
{ok, Value}
, where Value
is an instance of info()
associated with Node
, or error
if no info is associated with Node
.
-spec init() -> ok.
-spec is_connected(NodeOrSpec :: partisan:node_spec() | node()) -> boolean().
NodeOrName
. If Node
is this node, returns true
.
-spec is_connected(NodeOrSpec :: partisan:node_spec() | node(), Channels :: maybe_var(partisan:channel() | [partisan:channel()])) -> boolean() | no_return().
NodeOrName
. If Node
is this node, returns true
.
-spec is_fully_connected(Peer :: partisan:node_spec() | node()) -> boolean().
parallelism
configuration parameter) for all the configured channels with node NodeOrSpec
.
-spec kill_all() -> ok.
-spec listen_addr(connection()) -> partisan:listen_addr() | no_return().
-spec node(info() | connection()) -> node() | no_return().
-spec node_spec(info() | connection()) -> partisan:node_spec() | no_return().
-spec nodes() -> [node()].
-spec pid(connection()) -> pid().
-spec processes(NodeOrSpec :: atom() | partisan:node_spec()) -> [pid()].
-spec processes(NodeOrSpec :: node() | partisan:node_spec(), Channel :: maybe_var(partisan:channel())) -> [pid()].
-spec prune(pid() | node() | partisan:node_spec()) -> {info(), connections()} | no_return().
-spec store(Node :: partisan:node_spec(), Pid :: pid(), Channel :: partisan:channel(), LitenAddr :: partisan:listen_addr()) -> ok | no_return().
-spec timestamp(info() | connection()) -> non_neg_integer() | no_return().