-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathredis-cmd-zadd.drawio
131 lines (131 loc) · 15.5 KB
/
redis-cmd-zadd.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<mxfile host="Electron" modified="2024-12-17T16:25:13.095Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.5 Chrome/114.0.5735.243 Electron/25.3.1 Safari/537.36" etag="6PpAWffYryUmswCdzfun" version="21.6.5" type="device">
<diagram id="oBw_qqJAZGGyLAkMiL3p" name="第 1 页">
<mxGraphModel dx="989" dy="606" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="HGKUAlMKFO4TREOeEvBw-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;curved=1;" parent="1" source="kFmA6Fi3ztpmuOoM7vwJ-1" target="kFmA6Fi3ztpmuOoM7vwJ-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="kFmA6Fi3ztpmuOoM7vwJ-1" value="<font style="font-size: 10px">zaddGenericCommand(client *c, int flags)</font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="40" y="40" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;curved=1;" parent="1" source="kFmA6Fi3ztpmuOoM7vwJ-2" target="HGKUAlMKFO4TREOeEvBw-3" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="kFmA6Fi3ztpmuOoM7vwJ-2" value="<span style="font-size: 10px">解析特殊参数 flags&nbsp;<br>低4bit每bit代表一种含义<br></span>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="240" y="40" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-2" value="<div style="font-size: 8px"><font style="font-size: 8px" color="#007fff">#define ZADD_IN_NONE 0</font></div><div style="font-size: 8px"><font style="font-size: 8px" color="#007fff">#define ZADD_IN_INCR (1&lt;&lt;0)</font></div><div style="font-size: 8px"><font style="font-size: 8px" color="#007fff">#define ZADD_IN_NX (1&lt;&lt;1)&nbsp;&nbsp;</font></div><div style="font-size: 8px"><font style="font-size: 8px" color="#007fff">#define ZADD_IN_XX (1&lt;&lt;2)&nbsp;&nbsp;</font></div><div style="font-size: 8px"><font style="font-size: 8px" color="#007fff">#define ZADD_IN_GT (1&lt;&lt;3)&nbsp;&nbsp;</font></div><div style="font-size: 8px"><font style="font-size: 8px" color="#007fff">#define ZADD_IN_LT (1&lt;&lt;4)&nbsp;&nbsp;</font></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="400" y="15" width="130" height="90" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-7" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=8;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-3" target="HGKUAlMKFO4TREOeEvBw-6" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-11" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-3" target="HGKUAlMKFO4TREOeEvBw-10" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-3" value="<span style="font-size: 10px">从传参中读取分数存储到<br>double指针<br></span>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="240" y="120" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-9" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-6" target="HGKUAlMKFO4TREOeEvBw-8" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-6" value="<span style="font-size: 10px">scores = zmalloc(sizeof(double)*elements);</span>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="440" y="120" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-8" value="<span style="font-size: 10px">for (j = 0; j &lt; elements; j++) :</span><br><span style="font-size: 10px">getDoubleFromObjectOrReply(c,c-&gt;argv[scoreidx+j*2],&amp;scores[j],NULL)</span>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="425" y="180" width="190" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-16" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-10" target="HGKUAlMKFO4TREOeEvBw-15" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-10" value="<span style="font-size: 10px">zobj = lookupKeyWrite(c-&gt;db,key);</span>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="240" y="260" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-12" value="后面是老一套流程" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="150" y="260" width="80" height="20" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-19" value="Y" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-15" target="HGKUAlMKFO4TREOeEvBw-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-24" style="edgeStyle=orthogonalEdgeStyle;curved=1;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;fontSize=9;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-15" target="HGKUAlMKFO4TREOeEvBw-23" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-15" value="<font style="font-size: 10px">zobj == NULL<br>key不存在<br></font>" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1">
<mxGeometry x="280" y="320" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-27" style="edgeStyle=orthogonalEdgeStyle;curved=1;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;fontSize=9;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-17" target="HGKUAlMKFO4TREOeEvBw-25" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="720" y="480" />
<mxPoint x="500" y="480" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-17" value="<span style="font-size: 10px">zobj = createZsetObject()</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="640" y="340" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-20" value="Y" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fontSize=9;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-18" target="HGKUAlMKFO4TREOeEvBw-17" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-22" value="<font style="font-size: 8px">N</font>" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontSize=9;fontColor=#007FFF;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="HGKUAlMKFO4TREOeEvBw-18" target="HGKUAlMKFO4TREOeEvBw-21" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="500" y="430" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-18" value="<div style="font-size: 9px"><font style="font-size: 9px">server.<b>zset_max_ziplist_entries</b> == 0 ||</font></div><div style="font-size: 9px"><font style="font-size: 9px">server.<b>zset_max_ziplist_value</b> &lt; <br>sdslen(c-&gt;argv[scoreidx+1]-&gt;ptr)</font></div>" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1">
<mxGeometry x="400" y="320" width="200" height="80" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-26" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-21" target="HGKUAlMKFO4TREOeEvBw-25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-21" value="<span style="font-size: 10px">zobj = createZsetZiplistObject()</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="420" y="420" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-38" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-23" target="HGKUAlMKFO4TREOeEvBw-37" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-23" value="<span style="font-size: 10px">for (j = 0; j &lt; elements; j++) :</span><br><span style="font-size: 10px">retval = <b>zsetAdd</b>(zobj, score, ele, flags, &amp;retflags, &amp;newscore)</span>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="240" y="580" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-34" style="edgeStyle=orthogonalEdgeStyle;curved=1;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;fontSize=8;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-25" target="HGKUAlMKFO4TREOeEvBw-23" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-25" value="<span style="font-size: 10px">dbAdd(c-&gt;db,key,zobj)</span>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="420" y="500" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-36" value="<div>配置参数:</div><div>zset_max_ziplist_entries = 0 或</div><div>zset_max_ziplist_value &lt; value值的长度<br>采用 zset 数据结构</div>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="600" y="280" width="180" height="60" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-40" value="ZIPLIST" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fontSize=10;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-37" target="HGKUAlMKFO4TREOeEvBw-39" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-42" value="SKIPLIST" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=10;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-37" target="HGKUAlMKFO4TREOeEvBw-41" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-37" value="<font style="font-size: 10px">zobj-&gt;encoding</font>" style="rhombus;whiteSpace=wrap;html=1;rounded=1;" parent="1" vertex="1">
<mxGeometry x="460" y="560" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-44" value="转换" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-39" target="HGKUAlMKFO4TREOeEvBw-43" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-39" value="更新/插值/<br>数据结构转换" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="620" y="580" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-41" value="更新/插值/<br>数据结构转换" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="620" y="660" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-46" value="" style="edgeStyle=orthogonalEdgeStyle;curved=1;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;" parent="1" source="HGKUAlMKFO4TREOeEvBw-43" target="HGKUAlMKFO4TREOeEvBw-45" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-43" value="<font style="font-size: 10px">zsetConvert(zobj,<br>OBJ_ENCODING_SKIPLIST)</font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="780" y="580" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="HGKUAlMKFO4TREOeEvBw-45" value="<font style="font-size: 10px">zsetConvert(zobj,<br>OBJ_ENCODING_SKIPLIST)</font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="980" y="580" width="160" height="40" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>