Permalink
Browse files

Allow unnamed seresye engines

  • Loading branch information...
1 parent e6ee118 commit ee968d6fb0036cf7a39c9c4b78f8816ec3e27ea3 @yrashk yrashk committed Jan 26, 2012
Showing with 13 additions and 4 deletions.
  1. +9 −3 src/seresye.erl
  2. +4 −1 src/seresye_sup.erl
View
@@ -12,18 +12,21 @@
%% External exports
%%====================================================================
--export([start/1, start/2, stop/1, get_engine/1,
+-export([start/0, start/1, start/2, stop/1, get_engine/1,
add_rules/2, add_rule/2, add_rule/3, assert/2, get_kb/1,
get_rules_fired/1, get_client_state/1,
set_client_state/2, query_kb/2, remove_rule/2, retract/2]).
%% gen_server callbacks
--export([start_link/1, start_link/2, init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3]).
+-export([start_link/0, start_link/1, start_link/2, init/1, handle_call/3,
+ handle_cast/2, handle_info/2, terminate/2, code_change/3]).
%%====================================================================
%% External functions
%%====================================================================
+start() ->
+ seresye_sup:start_engine().
+
start(Name) ->
seresye_sup:start_engine(Name).
@@ -79,6 +82,9 @@ query_kb(Name, Pattern) ->
%%%===================================================================
%%% gen_server callbacks
%%%===================================================================
+start_link() ->
+ gen_server:start_link(?MODULE, [], []).
+
start_link(Name) when is_atom(Name) ->
gen_server:start_link({local, Name}, ?MODULE, [], []).
View
@@ -12,7 +12,7 @@
-behaviour(supervisor).
%% API
--export([start_link/0, start_engine/1, start_engine/2]).
+-export([start_link/0, start_engine/0, start_engine/1, start_engine/2]).
%% Supervisor callbacks
-export([init/1]).
@@ -26,6 +26,9 @@
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
+start_engine() ->
+ supervisor:start_child(?SERVER, []).
+
start_engine(Name) ->
supervisor:start_child(?SERVER, [Name]).

0 comments on commit ee968d6

Please sign in to comment.