diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-04-30 21:10:06 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-04-30 21:10:06 -0400 |
commit | d02f6cf7a4857ba902884c7d3e29ae8ac65cb698 (patch) | |
tree | bd3a20d8eb95fc2c4040e1b6b553b848b27551fc /src |
skeleton for new RPC server
Diffstat (limited to 'src')
-rw-r--r-- | src/rexi_app.erl | 11 | ||||
-rw-r--r-- | src/rexi_server.erl | 33 | ||||
-rw-r--r-- | src/rexi_sup.erl | 15 |
3 files changed, 59 insertions, 0 deletions
diff --git a/src/rexi_app.erl b/src/rexi_app.erl new file mode 100644 index 00000000..dda57752 --- /dev/null +++ b/src/rexi_app.erl @@ -0,0 +1,11 @@ +-module(rexi_app). +-behaviour(application). +-export([start/2, stop/1]). + +-include_lib("eunit/include/eunit.hrl"). + +start(_Type, StartArgs) -> + rexi_sup:start_link(StartArgs). + +stop(_State) -> + ok. diff --git a/src/rexi_server.erl b/src/rexi_server.erl new file mode 100644 index 00000000..0e443607 --- /dev/null +++ b/src/rexi_server.erl @@ -0,0 +1,33 @@ +-module(rexi_server). +-behaviour(gen_server). +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, + code_change/3]). + +-export([start_link/0]). + +-include_lib("eunit/include/eunit.hrl"). + +-record(st, { + field = value +}). + +start_link() -> + gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). + +init([]) -> + {ok, #st{}}. + +handle_call(_Request, _From, State) -> + {reply, ok, State}. + +handle_cast(_Msg, State) -> + {noreply, State}. + +handle_info(_Info, State) -> + {noreply, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. diff --git a/src/rexi_sup.erl b/src/rexi_sup.erl new file mode 100644 index 00000000..3a518e7b --- /dev/null +++ b/src/rexi_sup.erl @@ -0,0 +1,15 @@ +-module(rexi_sup). +-behaviour(supervisor). +-export([init/1]). + +-export([start_link/1]). + +-include_lib("eunit/include/eunit.hrl"). + +start_link(Args) -> + supervisor:start_link({local,?MODULE}, ?MODULE, Args). + +init([]) -> + Mod = rexi_server, + Spec = {Mod, {Mod,start_link,[]}, permanent, 100, worker, [Mod]}, + {ok, {{one_for_one, 3, 10}, [Spec]}}. |