View Source partisan_gen (partisan v5.0.0-beta.15)
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()}
.
partisan_pluggable_peer_service_manager
.
Link to this section Summary
Types
-type linkage() :: 'link' | 'nolink'.
Functions
Returns opts from the calling process' dictionary. The returned list is guaranteed to have a value for key
channel
.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 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 option() :: {timeout, timeout()} | {debug, [debug_flag()]} | {hibernate_after, timeout()} | {spawn_opt, [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
-spec check_response(RequestId :: term(), Key :: request_id()) -> {reply, Reply :: term()} | no_reply | {error, {term(), server_ref()}}.
-spec erase_opts() -> ok.
-spec get_opts() -> [{atom(), any()}].
channel
.
-spec receive_response(RequestId :: request_id(), timeout()) -> {reply, Reply :: term()} | timeout | {error, {term(), server_ref()}}.
-spec send_request(Name :: server_ref(), Label :: term(), Request :: term()) -> request_id().
-spec send_request(Name :: server_ref(), Label :: term(), Request :: term(), Opts :: list()) -> request_id().
-spec set_opts([{atom(), any()}]) -> ok.
-spec wait_response(RequestId :: request_id(), timeout()) -> {reply, Reply :: term()} | timeout | {error, {term(), server_ref()}}.