osm-katana/.nornir/assets/region-clip-flow.svg
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1300 620" font-family="'DejaVu Sans', 'Segoe UI', sans-serif">
<defs>
<linearGradient id="board" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#0b1c2e"/><stop offset="1" stop-color="#06111d"/>
</linearGradient>
<linearGradient id="chip" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#14384f"/><stop offset="1" stop-color="#0e2a3e"/>
</linearGradient>
<linearGradient id="hot" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#1d6f4f"/><stop offset="1" stop-color="#27a36f"/>
</linearGradient>
<linearGradient id="clip" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#5a3a12"/><stop offset="1" stop-color="#3a2408"/>
</linearGradient>
<marker id="arrow" markerWidth="9" markerHeight="9" refX="7" refY="3" orient="auto">
<path d="M0,0 L7,3 L0,6 Z" fill="#6fd3f5"/>
</marker>
<marker id="drop" markerWidth="9" markerHeight="9" refX="7" refY="3" orient="auto">
<path d="M0,0 L7,3 L0,6 Z" fill="#e0793f"/>
</marker>
</defs>
<rect x="0" y="0" width="1300" height="620" fill="url(#board)"/>
<g stroke="#143a52" stroke-width="1"><line x1="0" y1="86" x2="1300" y2="86"/><line x1="0" y1="540" x2="1300" y2="540"/></g>
<!-- title -->
<text x="40" y="42" fill="#eaf6ff" font-size="22" font-weight="700">osm-katana · region-clip</text>
<text x="332" y="42" fill="#9fc9e0" font-size="14">the clip is a <tspan fill="#ffcf8f" font-weight="700">per-node test inside the workers</tspan> — <tspan fill="#7be3ad" font-weight="700">zero extra pass, ~30/32 cores</tspan></text>
<g font-size="12">
<line x1="40" y1="64" x2="78" y2="64" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<text x="86" y="68" fill="#cfe6f5">kept → coords + node record</text>
<line x1="320" y1="64" x2="358" y2="64" stroke="#e0793f" stroke-width="2.5" stroke-dasharray="5 4" marker-end="url(#drop)"/>
<text x="366" y="68" fill="#cfe6f5">outside → dropped before any tag-JSON</text>
<rect x="690" y="56" width="30" height="13" rx="3" fill="url(#clip)"/>
<text x="728" y="68" fill="#cfe6f5">clip test: bbox (free) → polygon ray-cast</text>
</g>
<!-- 1 READER -->
<rect x="40" y="170" width="190" height="210" rx="10" fill="url(#chip)" stroke="#2a6f93"/>
<text x="135" y="150" fill="#bfe6ff" font-size="14" font-weight="700" text-anchor="middle">1 READER</text>
<text x="135" y="206" fill="#eaf6ff" font-size="13" text-anchor="middle">mmap PBF /</text>
<text x="135" y="224" fill="#eaf6ff" font-size="13" text-anchor="middle">stream bz2/gz/xml</text>
<text x="135" y="262" fill="#9fc9e0" font-size="12" text-anchor="middle">emits CANDIDATE</text>
<text x="135" y="280" fill="#9fc9e0" font-size="12" text-anchor="middle">offsets (ring slots)</text>
<text x="135" y="330" fill="#7fb0cc" font-size="11" text-anchor="middle">reads only · zero-copy</text>
<text x="135" y="348" fill="#7fb0cc" font-size="11" text-anchor="middle">no clip here</text>
<!-- N WORKERS column -->
<text x="700" y="150" fill="#bfe6ff" font-size="14" font-weight="700" text-anchor="middle">N WORKERS (all cores)</text>
<!-- worker boxes -->
<g>
<rect x="330" y="120" width="740" height="130" rx="10" fill="#0e2a3e" stroke="#27506b"/>
<rect x="330" y="290" width="740" height="130" rx="10" fill="#0e2a3e" stroke="#27506b"/>
<text x="700" y="438" fill="#6f93ad" font-size="11" text-anchor="middle">• • • one unit carried through ALL stages, no barrier • • •</text>
</g>
<!-- worker 1 pipeline: decode -> coord -> CLIP -> tag/record -> encode -->
<g font-size="11">
<rect x="346" y="158" width="96" height="54" rx="6" fill="url(#chip)" stroke="#2a6f93"/>
<text x="394" y="182" fill="#eaf6ff" text-anchor="middle">decode blob</text>
<text x="394" y="198" fill="#9fc9e0" text-anchor="middle">(zstd+pbf)</text>
<rect x="470" y="158" width="96" height="54" rx="6" fill="url(#chip)" stroke="#2a6f93"/>
<text x="518" y="182" fill="#eaf6ff" text-anchor="middle">lon/lat deg</text>
<text x="518" y="198" fill="#9fc9e0" text-anchor="middle">delta decode</text>
<rect x="594" y="152" width="120" height="66" rx="6" fill="url(#clip)" stroke="#caa15f"/>
<text x="654" y="174" fill="#ffe6bf" text-anchor="middle" font-weight="700">CLIP TEST</text>
<text x="654" y="192" fill="#ffcf8f" text-anchor="middle">bbox & → poly</text>
<text x="654" y="208" fill="#ffcf8f" text-anchor="middle">ray-cast</text>
<rect x="742" y="158" width="118" height="54" rx="6" fill="url(#chip)" stroke="#2a6f93"/>
<text x="801" y="182" fill="#eaf6ff" text-anchor="middle">tag-JSON +</text>
<text x="801" y="198" fill="#9fc9e0" text-anchor="middle">NodeRecord</text>
<rect x="888" y="158" width="160" height="54" rx="6" fill="url(#hot)" stroke="#2f9f6f"/>
<text x="968" y="182" fill="#eafff4" text-anchor="middle" font-weight="700">encode row group</text>
<text x="968" y="198" fill="#d6ffe9" text-anchor="middle">(parallel zstd, worker)</text>
</g>
<!-- worker 1 arrows -->
<g>
<line x1="442" y1="185" x2="468" y2="185" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<line x1="566" y1="185" x2="592" y2="185" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<line x1="714" y1="185" x2="740" y2="185" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<line x1="860" y1="185" x2="886" y2="185" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<!-- dropped branch -->
<line x1="654" y1="218" x2="654" y2="262" stroke="#e0793f" stroke-width="2.5" stroke-dasharray="5 4" marker-end="url(#drop)"/>
<text x="700" y="250" fill="#e0a07f" font-size="11">outside region: skip (dense kv cursor still advances)</text>
</g>
<!-- pass-2 way membership note in second worker band -->
<g font-size="11">
<rect x="346" y="326" width="150" height="58" rx="6" fill="url(#chip)" stroke="#2a6f93"/>
<text x="421" y="350" fill="#eaf6ff" text-anchor="middle">pass 2: resolve</text>
<text x="421" y="366" fill="#9fc9e0" text-anchor="middle">way node-refs</text>
<rect x="540" y="320" width="200" height="70" rx="6" fill="url(#clip)" stroke="#caa15f"/>
<text x="640" y="344" fill="#ffe6bf" text-anchor="middle" font-weight="700">WAY MEMBERSHIP</text>
<text x="640" y="362" fill="#ffcf8f" text-anchor="middle">store holds only in-region nodes</text>
<text x="640" y="378" fill="#ffcf8f" text-anchor="middle">0 resolvable coords → drop way</text>
<rect x="784" y="326" width="200" height="58" rx="6" fill="url(#hot)" stroke="#2f9f6f"/>
<text x="884" y="350" fill="#eafff4" text-anchor="middle" font-weight="700">WKB + row group</text>
<text x="884" y="366" fill="#d6ffe9" text-anchor="middle">crossing way truncated</text>
<line x1="496" y1="355" x2="538" y2="355" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<line x1="740" y1="355" x2="782" y2="355" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
</g>
<!-- 1 WRITER -->
<rect x="1110" y="170" width="150" height="250" rx="10" fill="url(#chip)" stroke="#2a6f93"/>
<text x="1185" y="150" fill="#bfe6ff" font-size="14" font-weight="700" text-anchor="middle">1 WRITER</text>
<text x="1185" y="222" fill="#eaf6ff" font-size="13" text-anchor="middle">stitch pre-encoded</text>
<text x="1185" y="240" fill="#eaf6ff" font-size="13" text-anchor="middle">row groups in order</text>
<text x="1185" y="290" fill="#9fc9e0" font-size="12" text-anchor="middle">nodes.parquet</text>
<text x="1185" y="308" fill="#9fc9e0" font-size="12" text-anchor="middle">ways.parquet</text>
<text x="1185" y="326" fill="#9fc9e0" font-size="12" text-anchor="middle">relations.parquet</text>
<text x="1185" y="372" fill="#7fb0cc" font-size="11" text-anchor="middle">no heavy work here</text>
<!-- reader -> workers, workers -> writer -->
<line x1="230" y1="250" x2="328" y2="200" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<line x1="230" y1="300" x2="328" y2="350" stroke="#6fd3f5" stroke-width="3" marker-end="url(#arrow)"/>
<line x1="1048" y1="185" x2="1108" y2="240" stroke="#27a36f" stroke-width="3" marker-end="url(#arrow)"/>
<line x1="984" y1="355" x2="1108" y2="320" stroke="#27a36f" stroke-width="3" marker-end="url(#arrow)"/>
<!-- footer: bench result -->
<text x="40" y="572" fill="#bfe6ff" font-size="13" font-weight="700">Sweden ← europe PBF (32 GB), --poly sweden.poly (146 verts):</text>
<text x="455" y="572" fill="#cfe6f5" font-size="13">65 s wall · avg 29.9 / median 31.9 / peak 32 of 32 cores · 103.5M nodes · 9.27M ways</text>
<text x="40" y="596" fill="#7be3ad" font-size="12">vs osmium planet-bz2 clip ~8 h single-threaded — the clip stays Gatling (per-node, in-worker), never a serial pass.</text>
</svg>