Created
July 8, 2017 19:28
-
-
Save vladimir-vg/961a21ee2b2ca67d9aee1dca1a6efc03 to your computer and use it in GitHub Desktop.
espace demo 07-2017 erl modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(morpheus_sup). | |
-behaviour(supervisor). | |
-export([start_link/0]). | |
-export([init/1]). | |
start_link() -> | |
supervisor:start_link({local, ?MODULE}, ?MODULE, []). | |
init([]) -> | |
SupOpts = #{strategy => one_for_one, intensity => 5, period => 1}, | |
Children = [ | |
#{id => neo_worker, start => {neo, start_link, []}} | |
], | |
{ok, {SupOpts, Children}}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(neo). | |
-behaviour(gen_server). | |
-export([start_link/0]). | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). | |
start_link() -> | |
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). | |
init([]) -> | |
{ok, no_state}. | |
handle_info(Msg, State) -> | |
{stop, {unknown_message, Msg}, State}. | |
handle_call(find_smith, _From, State) -> | |
{reply, {found, hinding_under_the_table}, State}; | |
handle_call(Call, _From, State) -> | |
{stop, {unknown_call, Call}, State}. | |
handle_cast(Cast, State) -> | |
{stop, {unknown_cast, Cast}, State}. | |
code_change(_, State, _) -> {ok, State}. | |
terminate(_,_State) -> ok. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment