From ff49009be1b3bfb330493e67dce7bf2709224c94 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Mon, 19 Oct 2020 08:43:36 +0100 Subject: [PATCH] message delivery flow --- design/delivery.gv | 70 ++++++++++ design/delivery.svg | 326 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 396 insertions(+) create mode 100644 design/delivery.gv create mode 100644 design/delivery.svg diff --git a/design/delivery.gv b/design/delivery.gv new file mode 100644 index 000000000..4a284857b --- /dev/null +++ b/design/delivery.gv @@ -0,0 +1,70 @@ +digraph msgDelivery { + graph [fontname=arial] + node [fontname=arial fontsize=11 shape=box style=rounded] + edge [fontname=arial fontsize=10 arrowhead=open arrowtail=open] + + subgraph clusterSUB { + label="SUB" + lookup [label="lookup\nconnId"] + notify [label="notify\nserver\n(connId,\nClient)"] + OK [label="send OK"] + lookup -> forkSub [label="Nothing"] + lookup -> tryTakeMD1 [label="Just _"] + forkSub [label="forkIO\nsubscriber"] + tryTakeMD1 [label="tryTakeM d" color=blue] + forkSub -> notify -> tryTakeMD1 -> OK + } + + subgraph clusterSubscriber { + label="subscriber" + subgraph clusterMutexes { + label="TMVar's" + node [shape=circle] + a; d; + } + putMD [label="putM d" color=green style=square] + tryTakeMA [label="tryTakeM a" color=blue] + EOQ [label="send EOQ"] + MSG [label="send MSG"] + subgraph { + node [style=square] + readQ + peekQ + putMD [label="putM d" color=green] + } + putMD -> tryTakeMA + tryTakeMA -> readQ [label="Just _"] + readQ -> tryPeekQ + tryTakeMA -> tryPeekQ [label="Nothing"] + tryPeekQ -> MSG [label="Just msg"] + tryPeekQ -> EOQ [label="Nothing"] + EOQ -> peekQ + peekQ -> MSG [label="msg"] + MSG -> putMD + } + + subgraph clusterACK { + label="ACK" + tryPutMA [label="tryPutM a" color=green] + tryTakeMD2 [label="tryTakeM d" color=blue] + OK1 [label="send OK"] + ERR [label="send\nERR NOMSG"] + tryTakeMD2 -> tryPutMA -> OK1 [label="Just _"] + {tryPutMA tryTakeMD2} -> ERR [label="Nothing"] + } + + subgraph clusterEND { + label="END" + killSub [label="killThread\nsubscriber"] + END [label="send END"] + killSub -> END + } + + subgraph clusterDEL { + label="DEL" + killSub1 [label="killThread\nsubscriber"] + delQueue [label="delete queue"] + OK2 [label="send OK"] + killSub1 -> delQueue -> OK2 + } +} \ No newline at end of file diff --git a/design/delivery.svg b/design/delivery.svg new file mode 100644 index 000000000..dd3d07cb7 --- /dev/null +++ b/design/delivery.svg @@ -0,0 +1,326 @@ + + + + + + +msgDelivery + + +clusterSUB + +SUB + + +clusterSubscriber + +subscriber + + +clusterMutexes + +TMVar's + + +clusterACK + +ACK + + +clusterEND + +END + + +clusterDEL + +DEL + + + +lookup + +lookup +connId + + + +forkSub + +forkIO +subscriber + + + +lookup->forkSub + + +Nothing + + + +tryTakeMD1 + +tryTakeM d + + + +lookup->tryTakeMD1 + + +Just _ + + + +notify + +notify +server +(connId, +Client) + + + +notify->tryTakeMD1 + + + + + +OK + +send OK + + + +forkSub->notify + + + + + +tryTakeMD1->OK + + + + + +a + +a + + + +d + +d + + + +putMD + +putM d + + + +tryTakeMA + +tryTakeM a + + + +putMD->tryTakeMA + + + + + +readQ + +readQ + + + +tryTakeMA->readQ + + +Just _ + + + +tryPeekQ + +tryPeekQ + + + +tryTakeMA->tryPeekQ + + +Nothing + + + +EOQ + +send EOQ + + + +peekQ + +peekQ + + + +EOQ->peekQ + + + + + +MSG + +send MSG + + + +MSG->putMD + + + + + +readQ->tryPeekQ + + + + + +peekQ->MSG + + +msg + + + +tryPeekQ->EOQ + + +Nothing + + + +tryPeekQ->MSG + + +Just msg + + + +tryPutMA + +tryPutM a + + + +OK1 + +send OK + + + +tryPutMA->OK1 + + +Just _ + + + +ERR + +send +ERR NOMSG + + + +tryPutMA->ERR + + +Nothing + + + +tryTakeMD2 + +tryTakeM d + + + +tryTakeMD2->tryPutMA + + +Just _ + + + +tryTakeMD2->ERR + + +Nothing + + + +killSub + +killThread +subscriber + + + +END + +send END + + + +killSub->END + + + + + +killSub1 + +killThread +subscriber + + + +delQueue + +delete queue + + + +killSub1->delQueue + + + + + +OK2 + +send OK + + + +delQueue->OK2 + + + + +