Rename 'emqttd_hook' module to 'emqttd_hooks'

This commit is contained in:
Feng Lee 2017-02-16 10:56:53 +08:00
parent 4df2a71c27
commit cae247be97
2 changed files with 13 additions and 15 deletions

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2012-2017 Feng Lee <feng@emqtt.io>. %% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.
@ -14,10 +14,12 @@
%% limitations under the License. %% limitations under the License.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Facade Module for The EMQ Broker %% @doc EMQ Main Module.
-module(emqttd). -module(emqttd).
-author("Feng Lee <feng@emqtt.io>").
-include("emqttd.hrl"). -include("emqttd.hrl").
-include("emqttd_protocol.hrl"). -include("emqttd_protocol.hrl").
@ -138,23 +140,23 @@ subscriber_down(Subscriber) ->
-spec(hook(atom(), function(), list(any())) -> ok | {error, any()}). -spec(hook(atom(), function(), list(any())) -> ok | {error, any()}).
hook(Hook, Function, InitArgs) -> hook(Hook, Function, InitArgs) ->
emqttd_hook:add(Hook, Function, InitArgs). emqttd_hooks:add(Hook, Function, InitArgs).
-spec(hook(atom(), function(), list(any()), integer()) -> ok | {error, any()}). -spec(hook(atom(), function(), list(any()), integer()) -> ok | {error, any()}).
hook(Hook, Function, InitArgs, Priority) -> hook(Hook, Function, InitArgs, Priority) ->
emqttd_hook:add(Hook, Function, InitArgs, Priority). emqttd_hooks:add(Hook, Function, InitArgs, Priority).
-spec(unhook(atom(), function()) -> ok | {error, any()}). -spec(unhook(atom(), function()) -> ok | {error, any()}).
unhook(Hook, Function) -> unhook(Hook, Function) ->
emqttd_hook:delete(Hook, Function). emqttd_hooks:delete(Hook, Function).
-spec(run_hooks(atom(), list(any())) -> ok | stop). -spec(run_hooks(atom(), list(any())) -> ok | stop).
run_hooks(Hook, Args) -> run_hooks(Hook, Args) ->
emqttd_hook:run(Hook, Args). emqttd_hooks:run(Hook, Args).
-spec(run_hooks(atom(), list(any()), any()) -> {ok | stop, any()}). -spec(run_hooks(atom(), list(any()), any()) -> {ok | stop, any()}).
run_hooks(Hook, Args, Acc) -> run_hooks(Hook, Args, Acc) ->
emqttd_hook:run(Hook, Args, Acc). emqttd_hooks:run(Hook, Args, Acc).
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Debug %% Debug

View File

@ -1,5 +1,5 @@
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Copyright (c) 2016 Feng Lee <feng@emqtt.io>. %% Copyright (c) 2013-2017 EMQ Enterprise, Inc. (http://emqtt.io)
%% %%
%% Licensed under the Apache License, Version 2.0 (the "License"); %% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License. %% you may not use this file except in compliance with the License.
@ -14,12 +14,12 @@
%% limitations under the License. %% limitations under the License.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-module(emqttd_hook). -module(emqttd_hooks).
-author("Feng Lee <feng@emqtt.io>").
-behaviour(gen_server). -behaviour(gen_server).
-author("Feng Lee <feng@emqtt.io>").
%% Start %% Start
-export([start_link/0]). -export([start_link/0]).
@ -40,10 +40,6 @@
-define(HOOK_TAB, mqtt_hook). -define(HOOK_TAB, mqtt_hook).
%%--------------------------------------------------------------------
%% Start API
%%--------------------------------------------------------------------
start_link() -> start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).