DATE: 26 APR 2017

N2O Async: Supervised Processes

INTRO

The n2o_async module is a simplified way to create local protocols for Erlang/OTP gen_server. Each protocol then can be spawned under Erlang/OTP supervision. Such spawned protocol handlers can be selected by n2o. cache, which is ETS.

proc(Message,#handler{}) -> {ok,#handler{}} | {reply,Out,#handler{}}.

The proc/2 is a callback that will be called on each gen_server's calls: handle_call, handle_cast and handle_info, its init and terminate.

async(Proc) -> type gen_server:call/2.

Spawns proc/2 function inside gen_server under supervision.

init(Pid,Class,Name) -> type gen_server:call/2.

Put Pid in n2o cache and also remember the caller Pid for n2o messages.

flush(Channel) -> type gen_server:call/2.

Send FLUSH message with current actions in process dictionary, then cleanup all actions.

send(Class,Name,Message) -> type gen_server:call/2.

Sends gen_call message to process by Class,Name} key, which was stored in cache during initialization.

OTHER

Also you may refer to: n2o, n2o_nitro.

© Synrc Research Center