update guid section

This commit is contained in:
Feng 2016-04-02 15:08:10 +08:00
parent 313f4568dd
commit 9ed5d4fb86
1 changed files with 10 additions and 17 deletions

View File

@ -31,28 +31,22 @@ Design Philosophy
System Layers System Layers
------------- -------------
1. Connection Layer: 1. Connection Layer
Handle TCP and WebSocket connections, encode/decode MQTT packets. Handle TCP and WebSocket connections, encode/decode MQTT packets.
2. Session Layer: 2. Session Layer
Process MQTT PUBLISH/SUBSCRIBE Packets received from client, and deliver MQTT messages to client. Process MQTT PUBLISH/SUBSCRIBE Packets received from client, and deliver MQTT messages to client.
3. PubSub Layer: 3. PubSub Layer
Dispatch MQTT messages to subscribers in a node. Dispatch MQTT messages to subscribers in a node.
4. Routing(Distributed) Layer: 4. Routing(Distributed) Layer
Route MQTT messages between clustered nodes. Route MQTT messages between clustered nodes.
.. code::
-------------- ----------- ---------- ----------
Client --> | Connection | --> | Session | --> | PubSub | --> | Router |
-------------- ----------- ---------- ----------
---------------- ----------------
Connection Layer Connection Layer
---------------- ----------------
@ -132,13 +126,12 @@ PacketId and MessageId
The 16bits PacketId is defined by MQTT Protocol Specification, used by client/server to PUBLISH/PUBACK packets. A GUID(128bits globally unique Id) will be generated by the broker and assigned to a MQTT message. The 16bits PacketId is defined by MQTT Protocol Specification, used by client/server to PUBLISH/PUBACK packets. A GUID(128bits globally unique Id) will be generated by the broker and assigned to a MQTT message.
Format of the globally unique message id: Format of the globally unique message id::
+------------------------+----------------+------------+ --------------------------------------------------------
| Timestamp | NodeID + PID | Sequence | | Timestamp | NodeID + PID | Sequence |
+------------------------+----------------+------------+ |<------- 64bits ------->|<--- 48bits --->|<- 16bits ->|
| <-------64bits-------> | <---48bits---> | <-16bits-> | --------------------------------------------------------
+------------------------+----------------+------------+
1. Timestamp: erlang:system_time if Erlang >= R18, otherwise os:timestamp 1. Timestamp: erlang:system_time if Erlang >= R18, otherwise os:timestamp
2. NodeId: encode node() to 2 bytes integer 2. NodeId: encode node() to 2 bytes integer