znippy_zoomies/lib.rs
1//! znippy-zoomies — fast-as-hell building blocks extracted from katana-osm.
2//!
3//! - [`xml`]: generic VTD-style parallel XML element scanner (tag-vocabulary
4//! agnostic) — the scanning machinery [`vtd`] is now layered on top of.
5//! - [`vtd`]: VTD-style parallel OSM-XML scanner producing a compact `ElemIndex`
6//! (byte offsets into the file), plus zone-map summaries and byte-level attr parsers.
7//! - [`stree`]: Ragnar Groot Koerkamp's static search tree over sorted `i64` keys
8//! (AVX2), including an mmap-backed variant whose leaf layer IS the sorted file.
9//! - [`stree32`]: a clean clone of [`stree`] restored to Ragnar's ORIGINAL `u32`
10//! key width (B=16, `_mm256_cmpgt_epi32`) for future non-OSM use. A separate
11//! concrete type, never a generic `STree<T>` (the i64 path stays for OSM/skade).
12//! - [`chunk_revolver`]: zero-allocation slot pool for 1-reader / N-worker streaming.
13//! - [`gatling`]: generic no-barrier worker-pool engine (split → N decode → in-order
14//! collect → sink), parameterised by a [`gatling::Codec`] + [`gatling::Sink`].
15//! Its [`gatling::io`] submodule is the **async** sibling — a no-barrier, bounded,
16//! ordered async task pool for I/O-bound (network/PUT/GET) fan-out, same
17//! philosophy, tokio substrate instead of OS threads.
18//! - [`psort`]: parallel sample sort (and reference LSD radix) over 16-byte AoS
19//! records keyed by their leading `i64`.
20//! - [`gatling_sort`]: generic parallel comparison sort (`gatling_sort_by`
21//! stable / `gatling_sort_unstable_by` / `gatling_sort`), a merge sort fanned
22//! out on the gatling fork-join — the drop-in parallel `slice::sort_by`.
23//! - [`gatling_bfs`]: frontier-parallel BFS (`gatling_bfs` / `gatling_bfs_reachable`)
24//! over a generic `node -> neighbors` graph — expands each BFS level in parallel
25//! on the fork-join pool, merges the visited-set dedup at the level barrier.
26//! - [`json`]: zero-copy parallel NDJSON record scanner (the vtd pattern for
27//! JSON) — memchr newline split is safe by RFC 8259, plus an escape-aware
28//! top-level `find_key` field probe.
29//! - [`vann`]: pure vector-ANN engine — an exact brute-force ("flat") `f32`
30//! nearest-neighbour index (100%-recall oracle) with runtime-detected SIMD +
31//! int8/VNNI cosine kernels. Extracted from nornir.
32
33/// **Introspection / emit marker** — record one functional-status row for the
34/// nornir test matrix. Wraps `nornir_testmatrix::functional_status` behind the
35/// `testmatrix` feature (a compiled-out `#[inline]` no-op otherwise, with no
36/// nornir dep in the default build). `component` is the reporting surface (e.g.
37/// `"gatling_forkjoin"`), `check` what it verified, `ok` the verdict, `detail` a
38/// short human note. Mirrors the korp-collectors reference wiring so `nornir
39/// test --features testmatrix` SEES each gatling run.
40#[inline]
41pub fn functional_status(component: &str, check: &str, ok: bool, detail: &str) {
42 #[cfg(feature = "testmatrix")]
43 nornir_testmatrix::functional_status(component, check, ok, detail);
44 #[cfg(not(feature = "testmatrix"))]
45 {
46 let _ = (component, check, ok, detail);
47 }
48}
49
50// The no-barrier engine now lives in its own leaf crate (`gatling`) so the
51// codec sub-crates can depend on it without a cycle through this crate. Re-
52// exported unchanged so external consumers' `znippy_zoomies::gatling` /
53// `::gatling_forkjoin` / `::chunk_revolver` paths (and their submodules
54// `gatling::io` / `gatling::ordered`) keep resolving.
55pub use ::gatling::{
56 background, chunk_revolver, gatling, gatling_bfs, gatling_forkjoin, gatling_map, gatling_sort,
57};
58pub mod json;
59pub mod psort;
60pub mod stree;
61pub mod stree32;
62pub mod stree32_range;
63pub mod stree512;
64pub mod stree_hi32;
65/// **One binary, both machines** — the stree family's one-time SIMD capability
66/// resolution ([`stree_simd::path`]), plus the `ZNIPPY_STREE_SIMD` /
67/// [`stree_simd::force`] A/B knob. Every stree entry point branches on the
68/// resolved value; nothing calls `is_x86_feature_detected!` on a hot path.
69pub mod stree_simd;
70/// A payload-carrying **version log** over [`stree::STree64`]: exact (`at_exact`),
71/// point-in-time (`as_of`, the floor/predecessor) and replay-cut (`boundary_leq`)
72/// queries over an append-only, ascending-`i64`-keyed log.
73///
74/// Lives here rather than in a consumer because the floor descent belongs beside
75/// the exact lookup it complements — `STree64` reports only exact membership, so
76/// the predecessor variant has to exist somewhere, and a fork one repo downstream
77/// is the wrong somewhere. It arrived from `nornir/src/warehouse/ragnar.rs`, where
78/// it was `#![allow(dead_code)]` with every caller a bench or an example.
79pub mod stree_log;
80pub mod vann;
81pub mod vtd;
82pub mod vtd_single_pass;
83pub mod xml;