Format code
This commit is contained in:
parent
31e26ec5df
commit
e457b28fdd
|
@ -36,9 +36,9 @@
|
|||
|
||||
-record(state, {name, size, type}).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
%% API
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-spec(start_link(ecpool:pool_name(), list(ecpool:option()))
|
||||
-> {ok, pid()} | {error, term()}).
|
||||
|
@ -49,9 +49,9 @@ start_link(Pool, Opts) ->
|
|||
info(Pid) ->
|
||||
gen_server:call(Pid, info).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
%% gen_server callbacks
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
init([Pool, Opts]) ->
|
||||
Schedulers = erlang:system_info(schedulers),
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
start_link() ->
|
||||
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
%% Start/Stop a pool
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%% @doc Start a pool.
|
||||
-spec(start_pool(atom(), atom(), list(tuple())) -> {ok, pid()} | {error, term()}).
|
||||
|
@ -71,9 +71,9 @@ pools() ->
|
|||
[{Pool, Pid} || {{pool_sup, Pool}, Pid, supervisor, _}
|
||||
<- supervisor:which_children(?MODULE)].
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
%% Supervisor callbacks
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
init([]) ->
|
||||
{ok, { {one_for_one, 10, 100}, []} }.
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
|
||||
-record(state, {pool, id, client, mod, on_reconnect, opts}).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
%% Callback
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-ifdef(use_specs).
|
||||
|
||||
|
@ -54,9 +54,9 @@ behaviour_info(_Other) ->
|
|||
|
||||
-endif.
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
%% API
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%% @doc Start a pool worker.
|
||||
-spec(start_link(atom(), pos_integer(), module(), list()) ->
|
||||
|
@ -78,9 +78,9 @@ is_connected(Pid) ->
|
|||
set_reconnect_callback(Pid, OnReconnect) ->
|
||||
gen_server:cast(Pid, {set_reconn_callbk, OnReconnect}).
|
||||
|
||||
%%%=============================================================================
|
||||
%%% gen_server callbacks
|
||||
%%%=============================================================================
|
||||
%%--------------------------------------------------------------------
|
||||
%% gen_server callbacks
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
init([Pool, Id, Mod, Opts]) ->
|
||||
process_flag(trap_exit, true),
|
||||
|
@ -148,9 +148,9 @@ terminate(_Reason, #state{pool = Pool, id = Id, opts = Opts}) ->
|
|||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
%% Internal Functions
|
||||
%%------------------------------------------------------------------------------
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
connect(#state{mod = Mod, opts = Opts}) ->
|
||||
Mod:connect(connopts(Opts, [])).
|
||||
|
|
Loading…
Reference in New Issue