Commit Graph

51 Commits

Author SHA1 Message Date
Zaiming Shi bc6a87946c refactor(emqx_trie): store only prefixes
This commit refactors emqx_trie implementation
with mainly two changes

1. Deleted the edge table.

   In the old implementation, trie consist of nodes and edges.
   e.g. for topic 'a/b/+/d', node 'a' with edge 'b'
   points to node 'a/b' and so on.

   However, edges can be computed at runtime,
   so there is no need to store them in a table.
2021-04-26 14:18:40 +02:00
Zaiming Shi 6354e75626 chore: update copyrights 2021-04-23 20:43:00 +02:00
JianBo He d437f9f228 chore(elvis): fix elvis warnings 2021-01-14 15:46:16 +08:00
Ayodele 2b481dabe7
Fix some dialyzer warnings (#3988) 2021-01-05 20:49:50 +01:00
zhouzb 43b49edd28 feature(alarm): new design for alarm 2020-07-31 18:07:20 +08:00
JianBo He e3489b9d46 refactor(style): improve all types declaration
- Add dialyzer for code analysis
- Correct all the module type declarations
- Use `-type()` to declaration a type instead of `-opaque`
  (It is advantageous to the code dialyzer)

BROKEN CHANGES:
- Add a ?DEFAULT_SUBOPTS for emqx_broker:subscribe/1,2,3
- Remove the needless internal function `emqx_vm:port_info(PortTerm, Keys)`
2020-06-18 17:38:34 +08:00
terry-xiaoyu 6ad65d587e feature(properties): add properties in message header
1. Add MQTT5.0 properties when invoking the hooks.

- Add a new key `properties` into the message header:

  We used to put all of the properties into the `#message.headers`:

  ```erlang
  #message{headers = #{'User-Property' => {<<"reason">>,<<"normal">>},
                       'Message-Expiry-Interval' => 60,
                       allow_publish => true}
  ```

  I put them instead under a single key:

  ```erlang
  #message{headers = #{properties =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>},
                          'Message-Expiry-Interval' => 60},
                       allow_publish => true}
  ```

  Note that the column `properties` may contain all the properties for
  Publish and Will messages.

- Add `disconn_props` into the `Channel.conninfo`

- Add `puback_props` also into the message header:

  ```erlang
  #message{headers = #{puback_props =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>}},
                       allow_publish => true}
  ```

2. Change the data type of `#message.headers` and `#message.flags` to map.

   It used to support `undefined`.
2020-06-17 18:46:26 +08:00
zhouzb 3b537760d5 Read new configuration items when plugins is loaded 2020-03-23 15:23:38 +08:00
zhouzb 7ea75f4289 Update copyright 2020-01-03 18:31:08 +08:00
Feng Lee 0c377c67cd Use 'erlang:system_time' to replace 'os:timestamp' (#3088)
Use 'erlang:system_time/1' to replace 'os:timestamp/0'
2019-12-09 16:27:25 +08:00
zhouzb b7cafc0ba0 Update record banned 2019-11-15 14:55:14 +08:00
zhouzb d004a5b68e Rename 'client_id' field to 'clientid' 2019-09-29 16:46:27 +08:00
Feng Lee 2ed9e9480e Remove the default value of 'headers' field 2019-09-19 11:18:04 +08:00
turtled 91a8dbda56 Fix conflicts 2019-08-09 16:41:11 +08:00
Feng Lee c95a89ed1e Merge branch 'nchannel' into develop 2019-07-31 14:03:48 +08:00
terry-xiaoyu b0e2b7db0c Support inter-node messages via RPC cast 2019-07-27 12:59:07 +08:00
Feng Lee dfa2c2370e Define 'Otherwise' macro 2019-07-13 12:25:25 +08:00
Gilbert 70be888f3b Compat windows (#2665) 2019-07-05 23:10:13 +08:00
Feng Lee f32a415a83 Merge branch 'channel3' 2019-06-25 15:55:31 +08:00
turtled 481458d8ec Add plugin type 2019-06-21 19:52:53 +08:00
Feng Lee 7774b85f81 Implement the channel architecture 2019-06-18 15:03:51 +08:00
turtled 31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
spring2maz ae743ad1f0 Rewrite emqx_mqueue.erl
Fixed bugs:

- Priority queue lack of a `len + 1` logic in `in/2`

Changed behaviors:

- Topics not found in priority table (from config) will be treated with default priority,
  instead of hasing topic name to a priority number.
- Default priority is now configurable (it was always lower than all configured priorities)
- The dropped message due to reaching `max_len` is now returned from `in/2`,
  so the queue owner (`in/2` caller) can perform autopsy on it
2018-10-27 14:21:53 +02:00
Gilbert 4c40f75f4b Request & Response (broker and client) (#1819)
Add request & response support for CONNECT & CONNACK

Prior to this change, there is no validate and specified process for
Request-Response-Information and Response-Information

Also added basic Request/Response functionality to emqx_client implementation
2018-10-18 19:21:05 +02:00
terry-xiaoyu dd8513ad35 Update for banned API
Use `mnesia:foldl` to traverse mnesia rather than `mnesia:first` and
`mnesia:next`, as a badarg exception would occur if the record was
deleted while travering the whole table.
2018-09-07 14:10:16 +08:00
周子博 83e11b6e39 Add emqx_banned test suite, and fix bugs in emqx_banned 2018-08-30 22:45:08 +08:00
Feng Lee 567aeb274f Define types in emqx_types, emqx_mqtt_types modules 2018-08-29 23:08:55 +08:00
turtled 6478f811bf Fix conflicts 2018-08-27 10:29:22 +08:00
turtled 95d36d0204 Fix share sub bug 2018-08-27 10:15:41 +08:00
Feng Lee 0e3728c940 Add emqx_types module and 'credentials' type 2018-08-26 16:24:51 +08:00
Feng Lee 0f052ce352 Upgrade connection, protocol and session modules for MQTT 5.0 2018-08-24 18:39:59 +08:00
turtled 4d9e03a803 Refactor websocket conn using cowboy 2018-08-08 18:36:14 +08:00
Feng Lee 7d0cba9427 Add MQTT 5.0 supports for connection, protocol and session modules 2018-08-06 16:33:10 +08:00
Feng Lee b110a154ef Upgrade header files for EMQ X 3.0 2018-07-18 14:27:11 +08:00
Feng Lee 2a4ffc6645 Add more service modules for MQTT Version 5.0 2018-04-18 16:34:23 +08:00
Feng Lee bbb66ff92e Refactor the broker, router modules 2018-04-10 18:17:07 +08:00
Feng Lee bfb23ff0b2 Improve the design of MQTT session management 2018-04-08 15:16:05 +08:00
Feng Lee 39548cc399 Improve the session management 2018-04-04 15:28:01 +08:00
Feng Lee 2eed46310c Misc fix for the MQTT Version 5.0 2018-03-30 17:18:08 +08:00
Feng Lee 9976327c8d Add emqx_mqtt module 2018-03-23 18:13:09 +08:00
Feng Lee 56b88dd7f7 Improve the design of session management 2018-03-23 16:39:23 +08:00
Feng Lee 282e341433 EMQ X R3.0 - Improve the design of pubsub and router 2018-03-21 16:48:52 +08:00
Feng Lee 6a957e1b33 Support MQTT Version 5.0 2018-03-02 20:18:27 +08:00
Feng Lee aef5a20697 Add 'message' and 'delivery' record 2018-03-01 21:04:00 +08:00
Feng Lee d7eae533ac Merge the emqx-mqtt5 library 2018-02-28 21:22:39 +08:00
Feng Lee f7f0f27e4d Parse and serialize MQTT 5.0 protocol packets 2018-02-27 23:45:55 +08:00
Feng Lee f4fd6efe16 Merge the emqx-common, emqx-router libraries 2018-02-26 23:29:53 +08:00
Feng Lee fcb2ec8427 Merge the latest enterprise branch 2018-02-24 15:56:32 +08:00
Feng Lee b63c34ab14 Merge the latest master branch 2018-02-24 11:27:09 +08:00
Feng Lee a904dfd4f2 Comment the ERTS_MINIMUM macro 2017-12-07 16:26:32 +08:00