Diffinery

homeflare/celldpublic

celld/docs/services/durable-object-facets-flow.svg
126 lines · 7.6 KBRaw History
1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 440 372" role="img">
2 <title>Several facets share one cell, one owner node, and one owner record, while separate Durable Objects each take their own owner record and node</title>
3 <desc>Two arrangements of the same three application databases. On the left, a
4Worker calls one supervisor cell on node B at epoch e4. That single cell holds
5the supervisor's SQLite database and, in separate databases beside it, the
6facets app-a and app-b. One owner record covers all of them, and each database
7replicates as a stream under cells/acct-9/ltx/e4/, so the call takes one hop. On the right, the same three databases are three separate Durable Object
8cells on nodes B, C, and A. Each cell holds its own owner record and its own
9epoch, and the three replicate under three prefixes, so a call takes a hop and
10an output gate for each object.</desc>
11 <style>
12 .d-ink { color: #121212 }
13 .d-soft { color: #3d3b37 }
14 .d-faint { color: #6e6a62 }
15 .d-acc { color: #10803f }
16 .d-panel { color: #ffffff }
17 .d-sunk { color: #f0eee8 }
18 .d-tint { color: #d6efdf }
19 text {
20 font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
21 font-size: 13px;
22 fill: currentColor;
23 }
24 tspan { fill: currentColor; }
25 @media (prefers-color-scheme: dark) {
26 .d-ink { color: #efede7 }
27 .d-soft { color: #c9c6be }
28 .d-faint { color: #928e85 }
29 .d-acc { color: #3fc472 }
30 .d-panel { color: #1a1a19 }
31 .d-sunk { color: #232321 }
32 .d-tint { color: #10301d }
33 }
34 </style>
35 <defs>
36 <marker id="facet-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6"
37 markerHeight="6" orient="auto-start-reverse">
38 <path class="d-soft" fill="currentColor" d="M0 0 L10 5 L0 10 z" />
39 </marker>
40 </defs>
41
42 <!-- Column captions: one object with facets, against separate objects. -->
43 <text class="d-ink" fill="currentColor" x="110" y="14" text-anchor="middle">one object, two facets</text>
44 <text class="d-ink" fill="currentColor" x="330" y="14" text-anchor="middle">three separate objects</text>
45
46 <!-- The same caller in both arrangements. -->
47 <rect class="d-panel" fill="currentColor" x="6" y="24" width="208" height="32" rx="6" />
48 <rect class="d-soft" fill="none" stroke="currentColor" x="6" y="24" width="208" height="32" rx="6" />
49 <text class="d-soft" fill="currentColor" x="110" y="45" text-anchor="middle">Worker</text>
50
51 <rect class="d-panel" fill="currentColor" x="226" y="24" width="208" height="32" rx="6" />
52 <rect class="d-soft" fill="none" stroke="currentColor" x="226" y="24" width="208" height="32" rx="6" />
53 <text class="d-soft" fill="currentColor" x="330" y="45" text-anchor="middle">Worker</text>
54
55 <!-- One dispatch on the left; one dispatch for each object on the right. -->
56 <g class="d-soft" fill="none" stroke="currentColor" stroke-width="1.5">
57 <path d="M110 56 V74" marker-end="url(#facet-arrow)" />
58 <path d="M330 56 V66 H234 V219" />
59 <path d="M234 99 H246" marker-end="url(#facet-arrow)" />
60 <path d="M234 159 H246" marker-end="url(#facet-arrow)" />
61 <path d="M234 219 H246" marker-end="url(#facet-arrow)" />
62 </g>
63
64 <!-- One cell, one owner, one epoch, and two private databases inside it. -->
65 <rect class="d-tint" fill="currentColor" x="6" y="74" width="208" height="172" rx="6" />
66 <rect class="d-acc" fill="none" stroke="currentColor" stroke-width="2" x="6" y="74" width="208" height="172" rx="6" />
67 <text class="d-ink" fill="currentColor" x="110" y="95" text-anchor="middle">supervisor cell</text>
68 <text class="d-soft" fill="currentColor" x="110" y="112" text-anchor="middle">node B · epoch e4</text>
69
70 <rect class="d-sunk" fill="currentColor" x="16" y="122" width="188" height="34" rx="6" />
71 <rect class="d-soft" fill="none" stroke="currentColor" x="16" y="122" width="188" height="34" rx="6" />
72 <text class="d-ink" fill="currentColor" x="110" y="144" text-anchor="middle">supervisor SQLite</text>
73
74 <g class="d-faint" fill="none" stroke="currentColor" stroke-dasharray="5 4">
75 <path d="M16 168 H46" />
76 <path d="M174 168 H204" />
77 </g>
78 <text class="d-faint" fill="currentColor" x="110" y="172" text-anchor="middle">separate databases</text>
79
80 <rect class="d-sunk" fill="currentColor" x="16" y="180" width="90" height="56" rx="6" />
81 <rect class="d-soft" fill="none" stroke="currentColor" x="16" y="180" width="90" height="56" rx="6" />
82 <text class="d-ink" fill="currentColor" x="61" y="202" text-anchor="middle">facet app-a</text>
83 <text class="d-soft" fill="currentColor" x="61" y="221" text-anchor="middle">own SQLite</text>
84
85 <rect class="d-sunk" fill="currentColor" x="114" y="180" width="90" height="56" rx="6" />
86 <rect class="d-soft" fill="none" stroke="currentColor" x="114" y="180" width="90" height="56" rx="6" />
87 <text class="d-ink" fill="currentColor" x="159" y="202" text-anchor="middle">facet app-b</text>
88 <text class="d-soft" fill="currentColor" x="159" y="221" text-anchor="middle">own SQLite</text>
89
90 <!-- The same three databases as three cells, each with its own owner. -->
91 <rect class="d-panel" fill="currentColor" x="246" y="74" width="176" height="50" rx="6" />
92 <rect class="d-soft" fill="none" stroke="currentColor" x="246" y="74" width="176" height="50" rx="6" />
93 <text class="d-ink" fill="currentColor" x="334" y="95" text-anchor="middle">APP-A cell · node B</text>
94 <text class="d-soft" fill="currentColor" x="334" y="112" text-anchor="middle">own owner record · e4</text>
95
96 <rect class="d-panel" fill="currentColor" x="246" y="134" width="176" height="50" rx="6" />
97 <rect class="d-soft" fill="none" stroke="currentColor" x="246" y="134" width="176" height="50" rx="6" />
98 <text class="d-ink" fill="currentColor" x="334" y="155" text-anchor="middle">APP-B cell · node C</text>
99 <text class="d-soft" fill="currentColor" x="334" y="172" text-anchor="middle">own owner record · e9</text>
100
101 <rect class="d-panel" fill="currentColor" x="246" y="194" width="176" height="50" rx="6" />
102 <rect class="d-soft" fill="none" stroke="currentColor" x="246" y="194" width="176" height="50" rx="6" />
103 <text class="d-ink" fill="currentColor" x="334" y="215" text-anchor="middle">APP-C cell · node A</text>
104 <text class="d-soft" fill="currentColor" x="334" y="232" text-anchor="middle">own owner record · e2</text>
105
106 <!-- One stream against three streams. -->
107 <g class="d-soft" fill="none" stroke="currentColor" stroke-width="1.5">
108 <path d="M110 246 V272" marker-end="url(#facet-arrow)" />
109 <path d="M422 99 H428 V264 H330 V272" marker-end="url(#facet-arrow)" />
110 <path d="M422 159 H428" />
111 <path d="M422 219 H428" />
112 </g>
113
114 <rect class="d-sunk" fill="currentColor" x="6" y="272" width="208" height="52" rx="6" />
115 <rect class="d-soft" fill="none" stroke="currentColor" x="6" y="272" width="208" height="52" rx="6" />
116 <text class="d-ink" fill="currentColor" x="110" y="293" text-anchor="middle">cells/acct-9/ltx/e4/</text>
117 <text class="d-soft" fill="currentColor" x="110" y="311" text-anchor="middle">a stream per database</text>
118
119 <rect class="d-sunk" fill="currentColor" x="226" y="272" width="208" height="52" rx="6" />
120 <rect class="d-soft" fill="none" stroke="currentColor" x="226" y="272" width="208" height="52" rx="6" />
121 <text class="d-ink" fill="currentColor" x="330" y="293" text-anchor="middle">three bucket prefixes</text>
122 <text class="d-soft" fill="currentColor" x="330" y="311" text-anchor="middle">three epochs</text>
123
124 <text class="d-faint" fill="currentColor" x="110" y="348" text-anchor="middle">one hop, one owner record</text>
125 <text class="d-faint" fill="currentColor" x="330" y="348" text-anchor="middle">a hop and a gate for each</text>
126</svg>