initial commit
I have an implementation of reliable messages in another repo, but I want to start over with a focus on streams.
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
-module(msp).
|
||||
-behavior(application).
|
||||
|
||||
-export([start/0, stop/0]).
|
||||
-export([start/2, stop/1]).
|
||||
|
||||
start() -> application:start(hakuzaru).
|
||||
|
||||
stop() -> application:stop(hakuzaru).
|
||||
|
||||
start(normal, _Args) ->
|
||||
msp_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
ok.
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
-module(msp_man).
|
||||
-behaviour(gen_server).
|
||||
|
||||
-export([start_link/0]).
|
||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2]).
|
||||
|
||||
-record(s,
|
||||
{}).
|
||||
|
||||
-type state() :: #s{}.
|
||||
|
||||
start_link() ->
|
||||
gen_server:start_link({local, ?MODULE}, ?MODULE, none, []).
|
||||
|
||||
-spec init(none) -> {ok, state()}.
|
||||
|
||||
init(none) ->
|
||||
ok = io:format("msp_man starting.~n", []),
|
||||
State = #s{},
|
||||
{ok, State}.
|
||||
|
||||
handle_call(_, _, State) ->
|
||||
{reply, ok, State}.
|
||||
|
||||
handle_cast(_, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
handle_info(Unexpected, State) ->
|
||||
ok = io:format("Warning: Unexpected info ~p~n", [Unexpected]),
|
||||
{noreply, State}.
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
-module(msp_sup).
|
||||
-behaviour(supervisor).
|
||||
|
||||
-export([start_link/0]).
|
||||
-export([init/1]).
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
RestartStrategy = {one_for_one, 0, 60},
|
||||
Children = [{msp_man,
|
||||
{msp_man, start_link, []},
|
||||
permanent,
|
||||
5000,
|
||||
worker,
|
||||
[msp_man]}],
|
||||
{ok, {RestartStrategy, Children}}.
|
||||
Reference in New Issue
Block a user