Просмотр исходного кода

Merge branch 'dev' of github.com:emqtt/emqtt into dev

Feng Lee 11 лет назад
Родитель
Сommit
89553dff69
6 измененных файлов с 91 добавлено и 22 удалено
  1. 1 0
      CHANGELOG.md
  2. 0 20
      README.md
  3. 2 1
      apps/emqtt/include/emqtt_topic.hrl
  4. 51 0
      apps/emqtt/src/emqtt_bridge_sup.erl
  5. 34 0
      doc/broker.md
  6. 3 1
      rel/files/app.config

+ 1 - 0
CHANGELOG.md

@@ -15,6 +15,7 @@ Change: fix emqtt_pubsub.erl to match '#', '+'
 
 Tests: emqtt_topic_tests.erl add more test cases
 
+
 v0.3.0-alpha (2015-01-18)
 ------------------------
 

+ 0 - 20
README.md

@@ -97,26 +97,6 @@ on 'host2':
 
 Run './bin/emqtt_ctl cluster' on 'host1' or 'host2' to check cluster nodes.
 
-## Cluster
-
-Suppose we cluster two nodes on 'host1', 'host2', steps:
-
-on 'host1':
-
-```
-./bin/emqtt start
-```
-
-on 'host2':
-
-```
-./bin/emqtt start
-
-./bin/emqtt cluster emqtt@host1
-```
-
-Run './bin/emqtt cluster' on 'host1' or 'host2' to check cluster nodes.
-
 ## HTTP API
 
 eMQTT support http to publish message.

+ 2 - 1
apps/emqtt/include/emqtt_topic.hrl

@@ -39,7 +39,8 @@
 -record(topic_trie_node, {
     node_id        	:: binary() | atom(),
     edge_count = 0  :: non_neg_integer(),
-    topic    		:: binary()
+    topic    		:: binary(),
+    type = dynamic  :: dynamic | static
 }).
 
 -record(topic_trie_edge, {

+ 51 - 0
apps/emqtt/src/emqtt_bridge_sup.erl

@@ -0,0 +1,51 @@
+%%-----------------------------------------------------------------------------
+%% Copyright (c) 2012-2015, Feng Lee <feng@emqtt.io>
+%% 
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%% 
+%% The above copyright notice and this permission notice shall be included in all
+%% copies or substantial portions of the Software.
+%% 
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+%% SOFTWARE.
+%%------------------------------------------------------------------------------
+
+-module(emqtt_bridge_sup).
+
+-author('feng@emqtt.io').
+
+-behavior(supervisor).
+
+-export([start_link/0, start_bridge/2, stop_bridge/1, init/1]).
+
+start_link() ->
+    supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+%%TODO: FIXME LATER.
+start_bridge(Name, Opts) when is_atom(Name) ->
+    supervisor:start_child(?MODULE, {{bridge, Name}, 
+                            {eqmtt_bridge, start_link, [Opts]}, 
+                                transient, 16#fffff, worker, [emqtt_bridge]}).
+
+stop_bridge(Name) ->
+    ChildId = {bridge, Name},
+    case supervisor:terminate_child(?MODULE, ChildId) of
+        ok -> 
+            supervisor:delete_child(?MODULE, ChildId);
+        {error, Reason} -> 
+            {error, Reason}
+    end.
+
+init([]) ->
+    {ok, {{one_for_one, 10, 1000}, []}}.
+

+ 34 - 0
doc/broker.md

@@ -0,0 +1,34 @@
+# Broker Topics
+
+## Version
+
+$SYS/broker/version
+
+## Uptime
+
+$SYS/broker/uptime
+
+## Recevied and Sent
+
+$SYS/broker/bytes/received
+$SYS/broker/bytes/sent
+
+$SYS/broker/packets/received
+$SYS/broker/packets/sent
+
+$SYS/broker/messages/received
+$SYS/broker/messages/sent
+$SYS/broker/messages/retained
+$SYS/broker/messages/stored
+$SYS/broker/messages/dropped
+
+## Client Presence
+
+$SYS/broker/clients/connected
+$SYS/broker/clients/disconnected
+
+$SYS/broker/clients/${clientId}/presences/online
+$SYS/broker/clients/${clientId}presences/offline
+
+
+

+ 3 - 1
rel/files/app.config

@@ -32,7 +32,9 @@
 	]}
  ]},
  {emqtt, [
-    {auth, {anonymous, []}}, %internal, anonymous
+    %Authetication. Internal, Anonymous Default.
+    {auth, {anonymous, []}}, 
+    {access, []},
     {session, [ 
         {expires, 1}, 
         {max_queue, 1000},