77 lines
4.7 KiB
XML
77 lines
4.7 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 1380" role="img" aria-labelledby="cache-key-lifecycle-title cache-key-lifecycle-desc">
|
|
<title id="cache-key-lifecycle-title">Учебный жизненный цикл версии кешированной публичной проекции</title>
|
|
<desc id="cache-key-lifecycle-desc">Вертикальная схема показывает запись source версии два, публичный ключ, запоздавшее событие ArticleChanged версии два, сравнение cache версии один с source версией два и пересборку публичной проекции до ответа читателю.</desc>
|
|
<defs>
|
|
<style>
|
|
.bg { fill: #0f172a; }
|
|
.title { fill: #f8fafc; font: 700 34px Arial, sans-serif; }
|
|
.subtitle { fill: #cbd5e1; font: 400 21px Arial, sans-serif; }
|
|
.card { fill: #172554; stroke: #60a5fa; stroke-width: 2; }
|
|
.card-warn { fill: #3f1d2e; stroke: #fb7185; stroke-width: 2; }
|
|
.card-ok { fill: #12332a; stroke: #34d399; stroke-width: 2; }
|
|
.badge { fill: #1d4ed8; }
|
|
.badge-warn { fill: #be123c; }
|
|
.badge-ok { fill: #047857; }
|
|
.badge-text { fill: #ffffff; font: 700 20px Arial, sans-serif; }
|
|
.head { fill: #f8fafc; font: 700 26px Arial, sans-serif; }
|
|
.body { fill: #dbeafe; font: 400 22px Arial, sans-serif; }
|
|
.body-warn { fill: #fecdd3; font: 400 22px Arial, sans-serif; }
|
|
.body-ok { fill: #d1fae5; font: 400 22px Arial, sans-serif; }
|
|
.mono { fill: #e0f2fe; font: 700 21px "Courier New", monospace; }
|
|
.arrow { stroke: #94a3b8; stroke-width: 4; fill: none; marker-end: url(#arrow); }
|
|
.note { fill: #94a3b8; font: 400 19px Arial, sans-serif; }
|
|
</style>
|
|
<marker id="arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto">
|
|
<path d="M0,0 L12,6 L0,12 z" fill="#94a3b8"/>
|
|
</marker>
|
|
</defs>
|
|
<rect class="bg" width="720" height="1380" rx="28"/>
|
|
<text class="title" x="48" y="66">Key → version → read</text>
|
|
<text class="subtitle" x="48" y="101">Учебный contract одной public проекции</text>
|
|
|
|
<rect class="card" x="48" y="142" width="624" height="170" rx="18"/>
|
|
<rect class="badge" x="72" y="166" width="102" height="38" rx="19"/>
|
|
<text class="badge-text" x="91" y="192">WRITE</text>
|
|
<text class="head" x="72" y="234">Source owner записал v2</text>
|
|
<text class="body" x="72" y="266">article guide-42 · visibility public</text>
|
|
<text class="body" x="72" y="296">Только source owner создаёт version.</text>
|
|
|
|
<path class="arrow" d="M360 312 L360 372"/>
|
|
|
|
<rect class="card" x="48" y="382" width="624" height="170" rx="18"/>
|
|
<rect class="badge" x="72" y="406" width="82" height="38" rx="19"/>
|
|
<text class="badge-text" x="92" y="432">KEY</text>
|
|
<text class="head" x="72" y="474">Reader scope входит в key</text>
|
|
<text class="mono" x="72" y="506">article:public:guide-42</text>
|
|
<text class="body" x="72" y="536">editorNote не входит в public value.</text>
|
|
|
|
<path class="arrow" d="M360 552 L360 612"/>
|
|
|
|
<rect class="card-warn" x="48" y="622" width="624" height="176" rx="18"/>
|
|
<rect class="badge-warn" x="72" y="646" width="98" height="38" rx="19"/>
|
|
<text class="badge-text" x="91" y="672">EVENT</text>
|
|
<text class="head" x="72" y="714">ArticleChanged v2 запоздало</text>
|
|
<text class="body-warn" x="72" y="746">Cache ещё хранит entry sourceVersion v1.</text>
|
|
<text class="body-warn" x="72" y="776">Delivery не равно праву вернуть v1.</text>
|
|
|
|
<path class="arrow" d="M360 798 L360 858"/>
|
|
|
|
<rect class="card-warn" x="48" y="868" width="624" height="176" rx="18"/>
|
|
<rect class="badge-warn" x="72" y="892" width="94" height="38" rx="19"/>
|
|
<text class="badge-text" x="90" y="918">READ</text>
|
|
<text class="head" x="72" y="960">Сравнение до cache hit</text>
|
|
<text class="body-warn" x="72" y="992">source v2 ≠ cached v1 → stale, не hit</text>
|
|
<text class="body-warn" x="72" y="1022">Собираем projection только из public fields.</text>
|
|
|
|
<path class="arrow" d="M360 1044 L360 1104"/>
|
|
|
|
<rect class="card-ok" x="48" y="1114" width="624" height="184" rx="18"/>
|
|
<rect class="badge-ok" x="72" y="1138" width="98" height="38" rx="19"/>
|
|
<text class="badge-text" x="90" y="1164">SAFE</text>
|
|
<text class="head" x="72" y="1206">stale-rebuilt → public v2</text>
|
|
<text class="body-ok" x="72" y="1238">Поздний event v2 сохраняет current entry v2.</text>
|
|
<text class="body-ok" x="72" y="1268">Если source стал private: deny и evict.</text>
|
|
|
|
<text class="note" x="48" y="1342">Map in memory · не Redis · не broker · не CDN</text>
|
|
</svg>
|