-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathels_gen_server.erl
56 lines (47 loc) · 1.93 KB
/
els_gen_server.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%%%=============================================================================
%%% @doc The {{name}} gen_server.
%%% @end
%%%=============================================================================
-module(els_{{name}}_server).
%%==============================================================================
%% API
%%==============================================================================
-export([ start_link/0
]).
%%==============================================================================
%% Callbacks for the gen_server behaviour
%%==============================================================================
-behaviour(gen_server).
-export([ init/1
, handle_call/3
, handle_cast/2
, handle_info/2
]).
-type state() :: #{}.
%%==============================================================================
%% Macro Definitions
%%==============================================================================
-define(SERVER, ?MODULE).
%%==============================================================================
%% API
%%==============================================================================
-spec start_link() -> {ok, pid()}.
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, unused, []).
%%==============================================================================
%% Callbacks for the gen_server behaviour
%%==============================================================================
-spec init(unused) -> {ok, state()}.
init(unused) ->
{ok, #{}}.
-spec handle_call(any(), {pid(), any()}, state()) ->
{reply, any(), state()} | {noreply, state()}.
handle_call(_Request, _From, State) ->
{noreply, State}.
-spec handle_cast(any(), state()) ->
{reply, any(), state()} | {noreply, state()}.
handle_cast(_Request, State) ->
{noreply, State}.
-spec handle_info(any(), state()) -> {noreply, state()}.
handle_info(_Request, State) ->
{noreply, State}.