View Source partisan_gen_server behaviour (partisan v5.0.0-beta.14)

This module is an adaptation of Erlang's gen_server module.

It replaces all instances of erlang:send/2 and erlang:monitor/2 with their Partisan counterparts.

NOTICE

At the moment this only works for partisan_pluggable_peer_service_manager backend.

Link to this section Summary

Link to this section Types

-type request_id() :: term().
-type server_ref() ::
    pid() |
    (LocalName :: atom()) |
    {Name :: atom(), Node :: atom()} |
    {global, GlobalName :: term()} |
    {via, RegMod :: module(), ViaName :: term()}.

Link to this section Callbacks

Link to this callback

code_change/3

View Source (optional)
-callback code_change(OldVsn :: term() | {down, term()}, State :: term(), Extra :: term()) ->
               {ok, NewState :: term()} | {error, Reason :: term()}.
Link to this callback

format_status/2

View Source (optional)
-callback format_status(Opt, StatusData) -> Status
                 when
                     Opt :: normal | terminate,
                     StatusData :: [PDict | State],
                     PDict :: [{Key :: term(), Value :: term()}],
                     State :: term(),
                     Status :: term().
-callback handle_call(Request :: term(), From :: {pid(), Tag :: term()}, State :: term()) ->
               {reply, Reply :: term(), NewState :: term()} |
               {reply, Reply :: term(), NewState :: term(), timeout() | hibernate} |
               {noreply, NewState :: term()} |
               {noreply, NewState :: term(), timeout() | hibernate} |
               {stop, Reason :: term(), Reply :: term(), NewState :: term()} |
               {stop, Reason :: term(), NewState :: term()}.
-callback handle_cast(Request :: term(), State :: term()) ->
               {noreply, NewState :: term()} |
               {noreply, NewState :: term(), timeout() | hibernate} |
               {stop, Reason :: term(), NewState :: term()}.
Link to this callback

handle_info/2

View Source (optional)
-callback handle_info(Info :: timeout | term(), State :: term()) ->
               {noreply, NewState :: term()} |
               {noreply, NewState :: term(), timeout() | hibernate} |
               {stop, Reason :: term(), NewState :: term()}.
-callback init(Args :: term()) ->
        {ok, State :: term()} |
        {ok, State :: term(), timeout() | hibernate} |
        {stop, Reason :: term()} |
        ignore.
-callback terminate(Reason :: normal | shutdown | {shutdown, term()} | term(), State :: term()) -> term().

Link to this section Functions

Link to this function

abcast(Nodes, Name, Request)

View Source
Link to this function

call(Name, Request, Timeout)

View Source
Link to this function

check_response(Msg, RequestId)

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

enter_loop(Mod, Options, State)

View Source
Link to this function

enter_loop(Mod, Options, State, ServerName)

View Source
Link to this function

enter_loop(Mod, Options, State, ServerName, Timeout)

View Source
Link to this function

format_log(Report, FormatOpts0)

View Source
Link to this function

format_status(Opt, StatusData)

View Source
Link to this function

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

View Source
Link to this function

multi_call(Nodes, Name, Req)

View Source
Link to this function

multi_call(Nodes, Name, Req, Timeout)

View Source
Link to this function

receive_response(RequestId, Timeout)

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

send_request(Name, Request)

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

start(Mod, Args, Options)

View Source
Link to this function

start(Name, Mod, Args, Options)

View Source
Link to this function

start_link(Mod, Args, Options)

View Source
Link to this function

start_link(Name, Mod, Args, Options)

View Source
Link to this function

start_monitor(Mod, Args, Options)

View Source
Link to this function

start_monitor(Name, Mod, Args, Options)

View Source
Link to this function

stop(Name, Reason, Timeout)

View Source
Link to this function

system_code_change(_, Module, OldVsn, Extra)

View Source
Link to this function

system_continue(Parent, Debug, _)

View Source
Link to this function

system_replace_state(StateFun, _)

View Source
Link to this function

system_terminate(Reason, Parent, Debug, _)

View Source
-spec system_terminate(_, _, _, [_]) -> no_return().
Link to this function

wait_response(RequestId, Timeout)

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

wake_hib(Parent, Name, State, Mod, HibernateAfterTimeout, Debug)

View Source