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

Types

-type connection() :: #partisan_peer_connection{}.
-type connections() :: [connection()].
-type info() :: #partisan_peer_info{}.
-type listen_addr_spec() :: #{ip := var(), port := var()}.
-type maybe_var(T) :: T | var().
-type optional(T) :: T | undefined.
-type var() :: '_' | '$1' | '$2' | '$3'.

Functions

Link to this function

channel(Partisan_peer_connection)

View Source
-spec channel(connection()) -> partisan:channel().
Returns the channel name of the connection
-spec connections() -> connections().
Finds connection for a node.
-spec connections(NodeOrSpec :: atom() | partisan:node_spec()) -> connections().
Finds connection for a node.
Link to this function

connections(NodeOrSpec, Channels)

View Source
-spec connections(NodeOrSpec :: maybe_var(atom() | partisan:node_spec()),
            Channels :: maybe_var(partisan:channel() | [partisan:channel()])) ->
               connections() | no_return().
Finds connection for a node and channel.
Link to this function

connections(NodeOrSpec, Channels, ListenAddr)

View Source
-spec connections(NodeOrSpec :: maybe_var(atom() | partisan:node_spec()),
            Channels :: maybe_var(partisan:channel() | [partisan:channel()]),
            ListenAddr :: partisan:listen_addr()) ->
               connections() | no_return().
Finds connection for a node and channel.
-spec count() -> non_neg_integer().
-spec count(Arg :: partisan:node_spec() | node() | info()) -> non_neg_integer().

Returns the number of connections for node Node.

When passed a 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.
Link to this function

count(NodeOrSpec, Channels)

View Source
-spec count(NodeOrSpec :: maybe_var(partisan:node_spec() | node()),
      Channels :: maybe_var(partisan:channel() | [partisan:channel()])) ->
         non_neg_integer() | no_return().
Returns the nbr of connections for node Node and channel Channel.
Link to this function

count(Node, Channels, ListenAddr)

View Source
-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}.
Return a pid to use for message dispatch.
Link to this function

dispatch_pid(Node, Channel)

View Source
-spec dispatch_pid(Node :: node() | partisan:node_spec(), Channel :: partisan:channel()) ->
                {ok, pid()} | {error, disconnected | not_yet_connected | notalive} | no_return().
Return a pid to use for message dispatch.
Link to this function

dispatch_pid(Node, Channel, PartitionKey)

View Source
-spec dispatch_pid(Node :: node() | partisan:node_spec(),
             Channel :: partisan:channel(),
             PartitionKey :: optional(any())) ->
                {ok, pid()} | {error, disconnected | not_yet_connected | notalive} | no_return().
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}.
-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.
Returns a tuple {ok, Value}, where Value is an instance of info() associated with Node, or error if no info is associated with Node.
-spec init() -> ok.
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.
Link to this function

is_connected(NodeOrSpec)

View Source
-spec is_connected(NodeOrSpec :: partisan:node_spec() | node()) -> boolean().
Returns true is this node is connected to NodeOrName. If Node is this node, returns true.
Link to this function

is_connected(NodeOrSpec, Channels)

View Source
-spec is_connected(NodeOrSpec :: partisan:node_spec() | node(),
             Channels :: maybe_var(partisan:channel() | [partisan:channel()])) ->
                boolean() | no_return().
Returns true is this node is connected to NodeOrName. If Node is this node, returns true.
Link to this function

is_fully_connected(Peer)

View Source
-spec is_fully_connected(Peer :: partisan:node_spec() | node()) -> boolean().
Returns true is this node has all the requested connections (parallelism configuration parameter) for all the configured channels with node NodeOrSpec.
-spec kill_all() -> ok.
Link to this function

listen_addr(Partisan_peer_connection)

View Source
-spec listen_addr(connection()) -> partisan:listen_addr() | no_return().
Link to this function

node(Partisan_peer_info)

View Source
-spec node(info() | connection()) -> node() | no_return().
Link to this function

node_spec(Partisan_peer_info)

View Source
-spec node_spec(info() | connection()) -> partisan:node_spec() | no_return().
Returns a list of all nodes specifications connected to this node.
-spec nodes() -> [node()].
Returns a list of all nodes connected to this node through normal connections (that is, hidden nodes are not listed).
Link to this function

pid(Partisan_peer_connection)

View Source
-spec pid(connection()) -> pid().
-spec processes(NodeOrSpec :: atom() | partisan:node_spec()) -> [pid()].
Returns the pids for all the active connection for a node.
Link to this function

processes(NodeOrSpec, Channel)

View Source
-spec processes(NodeOrSpec :: node() | partisan:node_spec(), Channel :: maybe_var(partisan:channel())) ->
             [pid()].
Returns the pids for all the active connection for a node and channel.
-spec prune(pid() | node() | partisan:node_spec()) -> {info(), connections()} | no_return().
Prune all occurrences of a connection pid returns the node where the pruned pid was found
Link to this function

store(Node, Pid, Channel, LitenAddr)

View Source
-spec store(Node :: partisan:node_spec(),
      Pid :: pid(),
      Channel :: partisan:channel(),
      LitenAddr :: partisan:listen_addr()) ->
         ok | no_return().
Store a connection
Link to this function

timestamp(Partisan_peer_info)

View Source
-spec timestamp(info() | connection()) -> non_neg_integer() | no_return().