View Source partisan_peer_service_manager behaviour (partisan v5.0.0-beta.13)

Link to this section Summary

Functions

mynode() deprecated
myself() deprecated
Internal function used by peer_service manager implementations to forward a message to a process identified by ServerRef that is either local or located at remote process when the remote node is connected via disterl. Trying to send a message to a remote server reference when the process is located at a node connected with Partisan will return ok but will not succeed.
Send a message to a remote peer_service_manager.

Link to this section Types

-type channel() :: atom().
-type forward_opts() ::
    #{ack => boolean(),
      causal_label => atom(),
      channel => channel(),
      clock => any(),
      partition_key => non_neg_integer(),
      transitive => boolean()} |
    [{ack, boolean()} |
     {causal_label, atom()} |
     {channel, channel()} |
     {clock, any()} |
     {partition_key, non_neg_integer()} |
     {transitive, boolean()}].
-type listen_addr() :: #{ip => inet:ip_address(), port => non_neg_integer()}.
-type message() :: term().
-type node_spec() ::
    #{name => node(),
      listen_addrs => [listen_addr()],
      channels => [channel()],
      parallelism => non_neg_integer()}.
-type server_ref() ::
    partisan_remote_ref:p() |
    partisan_remote_ref:encoded_pid() |
    partisan_remote_ref:n() |
    partisan_remote_ref:encoded_name() |
    (Name ::
         atom() |
         {Name :: atom(), node()} |
         {global, atom()} |
         {via, module(), ViaName :: atom()} |
         pid()).

Link to this section Callbacks

-callback cast_message(ServerRef :: server_ref(), Msg :: message()) -> ok.
-callback cast_message(ServerRef :: server_ref(), Msg :: message(), Opts :: forward_opts()) -> ok.
-callback cast_message(Node :: node(), ServerRef :: server_ref(), Msg :: message(), Opts :: forward_opts()) ->
                ok.
-callback decode(term()) -> term().
-callback forward_message(ServerRef :: server_ref(), Msg :: message()) -> ok.
-callback forward_message(ServerRef :: server_ref(), Msg :: message(), Opts :: forward_opts()) -> ok.
-callback forward_message(Node :: node(),
                ServerRef :: server_ref(),
                Msg :: message(),
                Opts :: forward_opts()) ->
                   ok.
-callback get_local_state() -> term().
-callback inject_partition(node_spec(), ttl()) -> {ok, reference()} | {error, not_implemented}.
-callback join(node_spec()) -> ok.
-callback leave() -> ok.
-callback leave(node_spec()) -> ok.
-callback members() -> [node()].
Link to this callback

members_for_orchestration/0

View Source
-callback members_for_orchestration() -> [node_spec()].
-callback myself() -> node_spec().
-callback on_down(node(), function()) -> ok | {error, not_implemented}.
-callback on_up(node(), function()) -> ok | {error, not_implemented}.
-callback partitions() -> {ok, partitions()} | {error, not_implemented}.
-callback receive_message(node(), message()) -> ok.
-callback reserve(atom()) -> ok | {error, no_available_slots}.
-callback resolve_partition(reference()) -> ok | {error, not_implemented}.
-callback send_message(node(), message()) -> ok.
-callback start_link() -> {ok, pid()} | ignore | {error, term()}.
-callback sync_join(node_spec()) -> ok | {error, not_implemented}.
-callback update_members([node()]) -> ok | {error, not_implemented}.

Link to this section Functions

This function is deprecated. use partisan:node/0 instead.
-spec mynode() -> atom().
This function is deprecated. use partisan:node_spec/0 instead.
-spec myself() -> node_spec().
Link to this function

process_forward(ServerRef, Msg)

View Source
-spec process_forward(ServerRef :: server_ref(), Msg :: any()) -> ok.
Internal function used by peer_service manager implementations to forward a message to a process identified by ServerRef that is either local or located at remote process when the remote node is connected via disterl. Trying to send a message to a remote server reference when the process is located at a node connected with Partisan will return ok but will not succeed.
Link to this function

send_message(Node, Message)

View Source
-spec send_message(node(), message()) -> ok.
Send a message to a remote peer_service_manager.