From 9ed5d4fb86b61ca725b7cb2ed47c48d4a447185a Mon Sep 17 00:00:00 2001 From: Feng Date: Sat, 2 Apr 2016 15:08:10 +0800 Subject: [PATCH] update guid section --- docs/source/design.rst | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/docs/source/design.rst b/docs/source/design.rst index f89ce3e5f..04f6715b2 100644 --- a/docs/source/design.rst +++ b/docs/source/design.rst @@ -31,28 +31,22 @@ Design Philosophy System Layers ------------- -1. Connection Layer: +1. Connection Layer 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. -3. PubSub Layer: +3. PubSub Layer Dispatch MQTT messages to subscribers in a node. - -4. Routing(Distributed) Layer: + +4. Routing(Distributed) Layer Route MQTT messages between clustered nodes. -.. code:: - - -------------- ----------- ---------- ---------- - Client --> | Connection | --> | Session | --> | PubSub | --> | Router | - -------------- ----------- ---------- ---------- - ---------------- 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. -Format of the globally unique message id: +Format of the globally unique message id:: -+------------------------+----------------+------------+ -| Timestamp | NodeID + PID | Sequence | -+------------------------+----------------+------------+ -| <-------64bits-------> | <---48bits---> | <-16bits-> | -+------------------------+----------------+------------+ + -------------------------------------------------------- + | Timestamp | NodeID + PID | Sequence | + |<------- 64bits ------->|<--- 48bits --->|<- 16bits ->| + -------------------------------------------------------- 1. Timestamp: erlang:system_time if Erlang >= R18, otherwise os:timestamp 2. NodeId: encode node() to 2 bytes integer