-
Notifications
You must be signed in to change notification settings - Fork 0
/
yunhuan_background.drawio
84 lines (84 loc) · 11.6 KB
/
yunhuan_background.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<mxfile host="app.diagrams.net" modified="2020-06-29T08:25:50.660Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36" etag="wkmbfbHmc8TgTI__gO34" version="13.3.5" type="github">
<diagram id="dvXGsRnJWB8gbnkpLMBo" name="Page-1">
<mxGraphModel dx="875" dy="5217" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="3300" pageHeight="4681" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="JokFo_8oz-sf4rnF7_rB-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="JokFo_8oz-sf4rnF7_rB-1" target="JokFo_8oz-sf4rnF7_rB-5" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="540" y="70" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="JokFo_8oz-sf4rnF7_rB-1" target="JokFo_8oz-sf4rnF7_rB-9" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-1" value="main" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="70" y="40" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="JokFo_8oz-sf4rnF7_rB-5" target="JokFo_8oz-sf4rnF7_rB-7" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-5" value="1.初始化redis<br>2.初始化socket服务端<br>3.监听客户端,有客户端发起连接后开启对应的守护进程" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="274" y="20" width="140" height="100" as="geometry" />
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-7" value="有IOnode节点连接时获取并开启保持其生命周期的携程,携程暂时不需要处理(没有设计对应的处理器)其他类型的socket客户端,如用户,消息,因为本项目暂时没有这种需求" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="494" y="-25" width="266" height="190" as="geometry" />
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="JokFo_8oz-sf4rnF7_rB-9" target="JokFo_8oz-sf4rnF7_rB-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-9" value="<div style="font-family: &quot;droid sans mono&quot;, monospace, monospace, &quot;droid sans fallback&quot;; font-size: 14px; line-height: 19px;"><font>startProcess</font></div>" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="70" y="297.5" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="JokFo_8oz-sf4rnF7_rB-11" value="<span style="font-family: &quot;droid sans mono&quot;, monospace, monospace, &quot;droid sans fallback&quot;; font-size: 14px;">processKeeper()是processRoute实体的方法,<br><br>processRoute实体在函数startProcess内创建,<br><br>startProcess是携程函数,每一个新的客户端请求都会对应<br><br>一个独立的startprocess()携程<br></span>" style="ellipse;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="250" y="194" width="430" height="267" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-1" value="<font><span>实例化</span><span style="font-family: &quot;droid sans mono&quot; , monospace , monospace , &quot;droid sans fallback&quot; ; font-size: 14px">utils.connTransfer结构体<br>(核心装配socket的conn)<br><br>调用connTransfer的<br></span></font><span style="font-family: &quot;droid sans mono&quot;, monospace, monospace, &quot;droid sans fallback&quot;; font-size: 14px;">AssertionAndReadPkg</span><span style="font-family: &quot;droid sans mono&quot;, monospace, monospace, &quot;droid sans fallback&quot;; font-size: 14px;">()方法获得mes的实体&nbsp;<br></span><font><span style="font-family: &quot;droid sans mono&quot; , monospace , monospace , &quot;droid sans fallback&quot; ; font-size: 14px"><br></span></font><font><span style="font-family: &quot;droid sans mono&quot; , monospace , monospace , &quot;droid sans fallback&quot; ; font-size: 14px">将mes实体传入之后的<br></span></font><span style="font-family: &quot;droid sans mono&quot; , monospace , monospace , &quot;droid sans fallback&quot; ; font-size: 14px">assertionAndProcessMes()方法</span><font><span style="font-family: &quot;droid sans mono&quot; , monospace , monospace , &quot;droid sans fallback&quot; ; font-size: 14px"><br></span></font>" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#FFFFFF;fontColor=#000000;labelBackgroundColor=#FFFFFF;" parent="1" vertex="1">
<mxGeometry x="295" y="510" width="340" height="340" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-2" value="processKeeper" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="61.25" y="630" width="170" height="100" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-3" value="<div style="font-family: &quot;droid sans mono&quot;, monospace, monospace, &quot;droid sans fallback&quot;; font-size: 14px; line-height: 19px;"><span style="">assertionAndProcessMes</span></div>" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="50" y="990" width="212.5" height="100" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-4" value="processKeeper()和assertionAndProcessMes()都是processer实体的方法<br>区别在于assertionAndProcessMes()<br>是被processKeeper()函数在其函数体内部调用的<br><br>而相同点是都可以直接使用socket的conn<br>因为socket的conn是<br>processer实体的初始字段" style="ellipse;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fillColor=#FFFFFF;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="335" y="900" width="415" height="280" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-6" value="assertionAndProcessMes内switch" style="rhombus;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fillColor=#FFFFFF;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="52.5" y="1280" width="210" height="140" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-7" value="根据mes包内Type字段不懂开启不同的分支,并启动不同的处理器<br><font color="#ff0000">注意:处理器已经不属于当前package内的实体了,而是属于逻辑上更内层的process包内的结构体<br>switch分支内同样会调用与需求所对应的process实体的方法</font>" style="ellipse;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fillColor=#FFFFFF;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="335" y="1220" width="545" height="260" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-10" value="" style="endArrow=none;html=1;labelBackgroundColor=#000000;strokeColor=#000000;fontColor=#000000;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="40" y="1200" as="sourcePoint" />
<mxPoint x="1596" y="1200" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-11" value="处理器" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fillColor=#FFFFFF;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="360" y="1570" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-12" value="用户处理器<br>(暂时不是重点)" style="rhombus;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fillColor=#B3B3B3;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="120" y="1780" width="180" height="140" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-13" value="消息处理器<br>(暂时不是重点)" style="rhombus;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fillColor=#B3B3B3;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="330" y="1780" width="180" height="140" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-14" value="传感器终端处理器" style="rhombus;whiteSpace=wrap;html=1;labelBackgroundColor=#ffffff;fillColor=#FFFFFF;fontColor=#FF0000;" parent="1" vertex="1">
<mxGeometry x="537" y="1780" width="180" height="140" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-16" value="在这里介绍下一个原子需求归类的问题:<br>需要拿用户处理器举例,当客户端发来一条数据,必然对应一种需求:<br>如:用户注册,用户登陆<br>这两种需求是原子级的不同,但是都属于用户实体的管辖范围<br>所以都需要创建用户处理器,再去调用对应的方法。<br><br>这里可以说,用户是所谓的“主语",而需要用到消息处理器的时候<br>自然而然消息就会变成了所谓的“主语”<br>同理传感器的情况" style="ellipse;whiteSpace=wrap;html=1;labelBackgroundColor=#FFFFFF;" parent="1" vertex="1">
<mxGeometry x="537" y="1490" width="450" height="240" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-17" value="设计思路升华:<br>以后会经常遇到设计处理器的情况<br>这决定了编程思想中<br>设计数据流向的思路是否成熟<br>这里属于对流向分支的把控<br>理解“主语”是谁十分钟要" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;labelBackgroundColor=#FFFFFF;fillColor=#FF3333;fontColor=#FF0000;size=0.2413793103448276;" parent="1" vertex="1">
<mxGeometry x="1060" y="1530" width="290" height="160" as="geometry" />
</mxCell>
<mxCell id="7K-qaFqnbJk-Yph1IfBK-18" value="处理器都需要<br>装配socket的conn<br>但是作用是用在函数<br>最后给客户端返回消息的" style="ellipse;whiteSpace=wrap;html=1;labelBackgroundColor=#FFFFFF;" parent="1" vertex="1">
<mxGeometry x="790" y="1790" width="250" height="120" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>