From 4d8e56b346bb9a52eccbb1dcbcc0b3d9dab1df29 Mon Sep 17 00:00:00 2001 From: Mathieu Lecarme Date: Tue, 26 Jul 2011 00:15:23 +0200 Subject: [PATCH] rename --- src/simple_queue.app.src | 12 ----- src/simple_queue.erl | 100 --------------------------------------- src/simple_queue_app.erl | 16 ------- src/simple_queue_sup.erl | 28 ----------- 4 files changed, 156 deletions(-) delete mode 100644 src/simple_queue.app.src delete mode 100644 src/simple_queue.erl delete mode 100644 src/simple_queue_app.erl delete mode 100644 src/simple_queue_sup.erl diff --git a/src/simple_queue.app.src b/src/simple_queue.app.src deleted file mode 100644 index 6ae6d32..0000000 --- a/src/simple_queue.app.src +++ /dev/null @@ -1,12 +0,0 @@ -{application, simple_queue, - [ - {description, ""}, - {vsn, "1"}, - {registered, []}, - {applications, [ - kernel, - stdlib - ]}, - {mod, { simple_queue_app, []}}, - {env, []} - ]}. diff --git a/src/simple_queue.erl b/src/simple_queue.erl deleted file mode 100644 index 1561d70..0000000 --- a/src/simple_queue.erl +++ /dev/null @@ -1,100 +0,0 @@ --module(simple_queue). --author('mathieu@garambrogne.net'). - --behaviour(gen_server). - -%% gen_server callbacks --export([start_link/1, init/1, handle_call/3, handle_cast/2, -handle_info/2, terminate/2, code_change/3]). - --record(state, { - max_size, - size, - queue - }). - -%%==================================================================== -%% api callbacks -%%==================================================================== - -start_link(MaxSize) -> - gen_server:start_link(?MODULE, [MaxSize], []). - -%%==================================================================== -%% gen_server callbacks -%%==================================================================== - -%%-------------------------------------------------------------------- -%% Function: init(Args) -> {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%% Description: Initiates the server -%%-------------------------------------------------------------------- -init([MaxSize]) -> - {ok, #state{ - size = 0, - max_size = MaxSize, - queue = queue:new() - }}. - -%%-------------------------------------------------------------------- -%% Function: %% handle_call(Request, From, State) -> {reply, Reply, State} | -%% {reply, Reply, State, Timeout} | -%% {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, Reply, State} | -%% {stop, Reason, State} -%% Description: Handling call messages -%%-------------------------------------------------------------------- -handle_call(_Request, _From, State) -> - {reply, State}. - -%%-------------------------------------------------------------------- -%% Function: handle_cast(Msg, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% Description: Handling cast messages -%%-------------------------------------------------------------------- -handle_cast(_Msg, State) -> - {noreply, State}. - -%%-------------------------------------------------------------------- -%% Function: handle_info(Info, State) -> {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} -%% Description: Handling all non call/cast messages -%%-------------------------------------------------------------------- -handle_info(_Info, State) -> - {noreply, State}. - -%%-------------------------------------------------------------------- -%% Function: terminate(Reason, State) -> void() -%% Description: This function is called by a gen_server when it is about to -%% terminate. It should be the opposite of Module:init/1 and do any necessary -%% cleaning up. When it returns, the gen_server terminates with Reason. -%% The return value is ignored. -%%-------------------------------------------------------------------- -terminate(_Reason, State) -> - {ok, State}. - -%%-------------------------------------------------------------------- -%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState} -%% Description: Convert process state when code is changed -%%-------------------------------------------------------------------- -code_change(_OldVsn, State, _Extra) -> - {ok, State}. - -%%-------------------------------------------------------------------- -%% Public API -%%-------------------------------------------------------------------- - -%%-------------------------------------------------------------------- -%% Private API -%%-------------------------------------------------------------------- - --ifdef(TEST). --include_lib("eunit/include/eunit.hrl"). - --endif. - diff --git a/src/simple_queue_app.erl b/src/simple_queue_app.erl deleted file mode 100644 index 0348cb0..0000000 --- a/src/simple_queue_app.erl +++ /dev/null @@ -1,16 +0,0 @@ --module(simple_queue_app). - --behaviour(application). - -%% Application callbacks --export([start/2, stop/1]). - -%% =================================================================== -%% Application callbacks -%% =================================================================== - -start(_StartType, _StartArgs) -> - simple_queue_sup:start_link(). - -stop(_State) -> - ok. diff --git a/src/simple_queue_sup.erl b/src/simple_queue_sup.erl deleted file mode 100644 index 53da157..0000000 --- a/src/simple_queue_sup.erl +++ /dev/null @@ -1,28 +0,0 @@ - --module(simple_queue_sup). - --behaviour(supervisor). - -%% API --export([start_link/0]). - -%% Supervisor callbacks --export([init/1]). - -%% Helper macro for declaring children of supervisor --define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}). - -%% =================================================================== -%% API functions -%% =================================================================== - -start_link() -> - supervisor:start_link({local, ?MODULE}, ?MODULE, []). - -%% =================================================================== -%% Supervisor callbacks -%% =================================================================== - -init([]) -> - {ok, { {one_for_one, 5, 10}, []} }. -