View Source partisan_gen (partisan v5.0.0-beta.21)

This module is an adaptation of Erlang's gen module which implements the really generic stuff of the generic standard behaviours (e.g. gen_server, gen_fsm).

It replaces all instances of erlang:send/2` and `erlang:monitor/2` with their Partisan counterparts. It maintains the `gen API with the following exceptions:

  • call/3` - the 3th argument accepts a timeout value but also a list of options containing any of the following: `{timeout, timeout()} | {channel, partisan:channel()}.
  • send_request/4` - the 4th argument is a list of options containing any of the following: `{channel, partisan:channel()}.
NOTICE: At the moment this only works for partisan_pluggable_peer_service_manager.

Link to this section Summary

Link to this section Types

-type debug_flag() :: trace | log | statistics | debug | {logfile, string()}.
-type emgr_name() :: {local, atom()} | {global, term()} | {via, Module :: module(), Name :: term()}.
-type linkage() :: monitor | link | nolink.
-type linkage() :: 'link' | 'nolink'.
-type option() ::
    {timeout, timeout()} |
    {debug, [debug_flag()]} |
    {hibernate_after, timeout()} |
    {spawn_opt, [partisan_proc_lib:spawn_option()]} |
    {channel, partisan:channel()}.
-type options() :: [option()].
-type request_id() :: term().
-type server_ref() :: pid() | atom() | {atom(), node()} | {global, term()} | {via, module(), term()}.
-type start_ret() :: {ok, pid()} | {ok, {pid(), reference()}} | ignore | {error, term()}.

Link to this section Functions

Link to this function

call(Process, Label, Request)

View Source
Link to this function

call(Process, Label, Request, Opts0)

View Source
Link to this function

check_response(RequestId, Key)

View Source
-spec check_response(RequestId :: term(), Key :: request_id()) ->
                  {reply, Reply :: term()} | no_reply | {error, {term(), server_ref()}}.
Link to this function

debug_options(Name, Opts)

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

format_status_header(TagLine, Pid)

View Source
-spec get_opts() -> [{atom(), any()}].
Returns opts from the calling process' dictionary. The returned list is guaranteed to have a value for key channel.
Link to this function

hibernate_after(Options)

View Source
Link to this function

init_it(GenMod, Starter, Parent, Mod, Args, Options)

View Source
Link to this function

init_it(GenMod, Starter, Parent, Name, Mod, Args, Options)

View Source
Link to this function

receive_response(RequestId, Timeout)

View Source
-spec receive_response(RequestId :: request_id(), timeout()) ->
                    {reply, Reply :: term()} | timeout | {error, {term(), server_ref()}}.
Link to this function

send_request(Name, Label, Request)

View Source
-spec send_request(Name :: server_ref(), Label :: term(), Request :: term()) -> request_id().
Link to this function

send_request(Name, Label, Request, Opts)

View Source
-spec send_request(Name :: server_ref(), Label :: term(), Request :: term(), Opts :: list()) ->
                request_id().
-spec set_opts([{atom(), any()}]) -> ok.
Set partisan options in the process dictionary of the calling process. These options are used by the partisan OTP behaviour either to set the options during init or when sending a request to a process implementing the behaviours. This library uses these approach to
Link to this function

start(GenMod, LinkP, Mod, Args, Options)

View Source
-spec start(module(), linkage(), module(), term(), options()) -> start_ret().
Link to this function

start(GenMod, LinkP, Name, Mod, Args, Options)

View Source
-spec start(module(), linkage(), emgr_name(), module(), term(), options()) -> start_ret().
Link to this function

stop(Process, Reason, Timeout)

View Source
Link to this function

wait_response(RequestId, Timeout)

View Source
-spec wait_response(RequestId :: request_id(), timeout()) ->
                 {reply, Reply :: term()} | timeout | {error, {term(), server_ref()}}.