Upgrade header files for EMQ X 3.0

This commit is contained in:
Feng Lee 2018-07-18 14:27:11 +08:00
parent b3adcc8971
commit b110a154ef
6 changed files with 81 additions and 94 deletions

View File

@ -4,9 +4,7 @@ PROJECT = emqx
PROJECT_DESCRIPTION = EMQ X Broker
PROJECT_VERSION = 3.0
NO_AUTOPATCH = gen_rpc cuttlefish
DEPS = goldrush gproc lager esockd ekka mochiweb pbkdf2 lager_syslog bcrypt clique jsx canal_lock
DEPS = goldrush gproc lager esockd ekka mochiweb pbkdf2 lager_syslog bcrypt clique jsx
dep_goldrush = git https://github.com/basho/goldrush 0.1.9
dep_gproc = git https://github.com/uwiger/gproc 0.7.0
@ -19,9 +17,9 @@ dep_ekka = git https://github.com/emqtt/ekka develop
dep_mochiweb = git https://github.com/emqtt/mochiweb emqx30
dep_pbkdf2 = git https://github.com/emqtt/pbkdf2 2.0.1
dep_bcrypt = git https://github.com/smarkets/erlang-bcrypt master
dep_clique = git https://github.com/emqtt/clique
dep_clique = git https://github.com/emqtt/clique
dep_canal_lock = git https://github.com/emqx/canal-lock
dep_clique = git https://github.com/emqx/clique
NO_AUTOPATCH = gen_rpc cuttlefish
ERLC_OPTS += +debug_info
ERLC_OPTS += +'{parse_transform, lager_transform}'

5
TODO
View File

@ -1,2 +1,5 @@
1. Update the README.md
2. Update the documentation
2. Update the Documentation
3. Shared subscription strategy and dispatch strategy

Binary file not shown.

View File

@ -1,30 +1,28 @@
%%%===================================================================
%%% Copyright (c) 2013-2018 EMQ Inc. All rights reserved.
%%%
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
%%% You may obtain a copy of the License at
%%%
%%% http://www.apache.org/licenses/LICENSE-2.0
%%%
%%% Unless required by applicable law or agreed to in writing, software
%%% distributed under the License is distributed on an "AS IS" BASIS,
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%%% See the License for the specific language governing permissions and
%%% limitations under the License.
%%%===================================================================
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%--------------------------------------------------------------------
%% Banner
%%--------------------------------------------------------------------
-define(COPYRIGHT, "Copyright (c) 2013-2018 EMQ Inc.").
-define(COPYRIGHT, "Copyright (c) 2018 EMQ Technologies Co., Ltd").
-define(LICENSE_MESSAGE, "Licensed under the Apache License, Version 2.0").
-define(PROTOCOL_VERSION, "MQTT/5.0").
-define(ERTS_MINIMUM_REQUIRED, "9.2").
-define(ERTS_MINIMUM_REQUIRED, "10.0").
%%--------------------------------------------------------------------
%% Topics' prefix: $SYS | $queue | $share
@ -52,11 +50,9 @@
| {share, binary()}
| {atom(), term()}).
-record(subscription,
{ subid :: binary() | atom(),
topic :: topic(),
subopts :: list(suboption())
}).
-record(subscription, {subid :: binary() | atom(),
topic :: topic(),
subopts :: list(suboption())}).
-type(subscription() :: #subscription{}).
@ -76,29 +72,20 @@
-type(mountpoint() :: binary()).
-type(connector() :: atom()).
-type(zone() :: undefined | atom()).
-type(zone() :: atom()).
-record(client,
{ client_id :: client_id(),
client_pid :: pid(),
zone :: zone(),
node :: node(),
username :: username(),
peername :: peername(),
protocol :: protocol(),
connector :: connector(),
mountpoint :: mountpoint(),
attributes :: #{atom() => term()}
}).
-record(client, {id :: client_id(),
pid :: pid(),
zone :: zone(),
peername :: peername(),
username :: username(),
protocol :: protocol(),
attributes :: #{atom() => term()},
connected_at :: erlang:timestamp()}).
-type(client() :: #client{}).
-record(session,
{ sid :: client_id(),
pid :: pid()
}).
-record(session, {sid :: client_id(), pid :: pid()}).
-type(session() :: #session{}).
@ -108,11 +95,12 @@
-type(message_id() :: binary() | undefined).
-type(message_flag() :: sys | dup | retain | atom()).
-type(message_flag() :: sys | qos | dup | retain | atom()).
-type(message_flags() :: #{message_flag() => boolean()}).
-type(message_flags() :: #{message_flag() => boolean() | integer()}).
-type(message_headers() :: #{packet_id => pos_integer(),
-type(message_headers() :: #{protocol => protocol(),
packet_id => pos_integer(),
priority => non_neg_integer(),
ttl => pos_integer(),
atom() => term()}).
@ -121,13 +109,13 @@
%% See 'Application Message' in MQTT Version 5.0
-record(message,
{ id :: message_id(), %% Global unique id
qos :: qos(), %% Message QoS
{ id :: message_id(), %% Message guid
qos :: qos(), %% Message qos
from :: atom() | client(), %% Message from
sender :: pid(), %% The pid of the sender/publisher
flags :: message_flags(), %% Message flags
headers :: message_headers(), %% Message headers
topic :: binary(), %% Message topic
topic :: topic(), %% Message topic
properties :: map(), %% Message user properties
payload :: payload(), %% Message payload
timestamp :: erlang:timestamp() %% Timestamp
@ -136,8 +124,9 @@
-type(message() :: #message{}).
-record(delivery,
{ message :: message(),
flows :: list()
{ node :: node(), %% The node that created the delivery
message :: message(), %% The message delivered
flows :: list() %% The message flow path
}).
-type(delivery() :: #delivery{}).
@ -219,12 +208,12 @@
%%--------------------------------------------------------------------
-record(command,
{ name,
action,
args = [],
opts = [],
usage,
descr
{ name :: atom(),
action :: atom(),
args = [] :: list(),
opts = [] :: list(),
usage :: string(),
descr :: string()
}).
-type(command() :: #command{}).

View File

@ -1,3 +1,16 @@
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
-define(record_to_map(Def, Rec),
maps:from_list(?record_to_proplist(Def, Rec))).

View File

@ -1,18 +1,16 @@
%%%===================================================================
%%% Copyright (c) 2013-2018 EMQ Inc. All rights reserved.
%%%
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
%%% You may obtain a copy of the License at
%%%
%%% http://www.apache.org/licenses/LICENSE-2.0
%%%
%%% Unless required by applicable law or agreed to in writing, software
%%% distributed under the License is distributed on an "AS IS" BASIS,
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%%% See the License for the specific language governing permissions and
%%% limitations under the License.
%%%===================================================================
%% Copyright (c) 2018 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%--------------------------------------------------------------------
%% MQTT SockOpts
@ -77,7 +75,7 @@
I =:= qos2; I =:= exactly_once)).
%%--------------------------------------------------------------------
%% Maximum ClientId Length. Why 1024?
%% Maximum ClientId Length.
%%--------------------------------------------------------------------
-define(MAX_CLIENTID_LEN, 1024).
@ -199,7 +197,7 @@
-define(MAX_PACKET_SIZE, 16#fffffff).
%%--------------------------------------------------------------------
%% MQTT Parser and Serializer
%% MQTT Frame Mask
%%--------------------------------------------------------------------
-define(HIGHBIT, 2#10000000).
@ -526,19 +524,5 @@
-type(mqtt_message() :: #mqtt_message{}).
-define(WILL_MSG(Qos, Retain, Topic, Props, Payload),
#mqtt_message{qos = WillQos, retain = WillRetain,
topic = WillTopic, properties = Props,
payload = WillPayload}).
%%--------------------------------------------------------------------
%% MQTT Delivery
%%--------------------------------------------------------------------
-record(mqtt_delivery,
{ sender :: pid(),
message :: mqtt_message(),
flows :: list()
}).
-type(mqtt_delivery() :: #mqtt_delivery{}).
#mqtt_message{qos = Qos, retain = Retain, topic = Topic, properties = Props, payload = Payload}).