config — the build’s named traits type¶
In one paragraph
Every compile-time knob a libtracer build has is a member of one named type,
tr::graph::default_config_t — sizes, padding widths, and the two policies the
build selects (which ACL evaluator, which last-known-value slot). An application
picks its configuration by making tr::graph::config_t name its own traits type,
once, app-wide; every loose spelling in the library is derived from that alias.
A second reader, tr::wire::config_reader_t, is the runtime counterpart: typed
accessors over a config SETTINGS TLV that arrived from a peer.
What it does¶
Two different things are called “configuration” here, and keeping them apart is the point.
Build configuration is default_config_t. It is not a set of macros and not
a template parameter: it is a struct whose members are static constexpr values
and nested type aliases, bound once by an alias. Being one named entity is what
makes a configuration diffable, passable to a test, and assertable on — a scatter
of independent #defines can only be read one at a time. It is bound per build
rather than threaded through the API because threading it through produces
byte-identical machine code while forking the process-global stripe and hazard
tables, which costs exactly the RAM the configuration exists to save.
The knob-by-knob narrative — what each knob costs on which target, and which ones are optimization rather than correctness — is the configuration space. This page is the API surface.
Runtime configuration is config_reader_t. A connection’s settings arrive as
a SPEC config SETTINGS TLV: positional NAME-key / value pairs, string values as
NAME children and integers as VALUE children. All six transport-side consumers
used to hand-roll the same walk — the universal keys plus the tcp, ws, can, quic and
webtransport factories — and this class is their one home. Unknown keys are ignored so
a newer peer can send more than a receiver understands, a key whose value child
has the wrong type is ignored, and a repeated key resolves to its last
well-formed occurrence. Each factory still reads only its own keys — what is
shared is the walk, not the vocabulary.
The walk is pair-consuming: it advances a whole (key, value) pair at a
time, so an unknown key is skipped together with its value. That is what lets
the tolerance coexist with positional pairing. Scanning every offset instead made
the grammar ambiguous — a pair whose string value textually equalled a known key
(link_hint = "addr") had that value re-read as a key, binding the following
child as addr and, under last-wins, destroying a legitimate earlier one. A
child that is not a NAME where a key belongs desynchronizes the stream and the
walk stops there rather than guessing a resync.
Which keys those factories actually read — the universal set and each kind’s private one, with the wire value each takes — is connection config. This page is the walk; that page is the vocabulary.
config_reader_t is the one home for the pair walk itself, everywhere it is read
tolerantly. It lives in tr::wire
(#985) — the layer that owns
the grammar — and the transport plane names it there too, so
graph_t::create_child (the creation SPEC) and the SUBSCRIBER QoS SETTINGS parse at
L4 read through the same type rather than carrying hand-written copies of the rule.
The one deliberate exception is graph::parse_acl
(#906) — the same mechanics
under the opposite unknown-key ruling, which is to reject: an ACL is a security
document, and the two duplicate-key families
(#995) must not share code
that could drift one toward the other.
Declaring your own build configuration¶
Inherit, override what differs, and bind the alias in a header your build puts
ahead of libtracer/config.hpp on the include path:
struct my_node_config_t : tr::graph::default_config_t {
static constexpr std::size_t kCacheLineBytes = 0; // single-core: no false sharing
using guard_t = my_rtos_critical_section_t; // interrupt-masked, never spins
using lkv_slot_t = tr::graph::single_writer_slot_t;
};
using config_t = my_node_config_t;
Inheriting rather than copying means a knob added later inherits its new default instead of failing to compile.
The two policies¶
A policy is a type the configuration selects, not a runtime flag, so the branch it removes is not on the hot path at all.
ACL policy — acl_policy_t picks how an access decision is evaluated.
allow_only_policy_t is the MCU profile: ALLOW entries only, no ordering
question to answer. full_acl_policy_t is the host profile: ordered
first-match-per-bit, DENY included. See security & ACL for
what the entries mean.
LKV slot policy — lkv_slot_t picks how a vertex publishes and reads its
last-known value. single_writer_slot_t is the default: a plain shared_ptr
swapped and copied inside guard_t (an interrupt-masked critical section
on a chip, the address-striped mutex_guard_t on a host), with no registry and a
publish that cannot fail. (kSingleWriter, the one-publisher-per-vertex promise
an RTOS build used to state, was removed in
#1718: no code read it.)
hazard_slot_t is the lock-free opt-in for a WIDE many-core host with many
readers of one hot vertex: an atomic<node_t*> reclaimed
with hazard pointers, which costs a fixed registry sized by kHazardReaderSlots,
a heap node per published value, and a publish that can fail under memory
exhaustion. A single core gains almost nothing from it and publishes slower, so
NARROW and MID builds keep single_writer_slot_t. Every
policy returns an owning handle from load() and declares may_spin, and a
build whose kSpinWaitSafe is false refuses a policy that can spin. The
refcount slot sp_atomic_slot_t was removed because libstdc++ spin-locks it
(#1618).
Reclamation policy — reclaim_policy_t picks when a retired subscription’s
{fn, ctx} pair is freed (reference/17).
reclaim_qsbr_t is the default on every target, a single-core RTOS included:
preemption alone reproduces the use-after-free it prevents, and on a unicore build
it costs about 22 instructions per publish and no fence. reclaim_strict_t is the
opt-out, and its precondition is a hard rule: NARROW bare metal with no preemption
and no second core, such as a superloop on a single-core Cortex-M. It cannot detect
a violation.
This axis and the LKV slot axis are independent. hazard_slot_t (WIDE) and
reclaim_strict_t (NARROW bare metal) are parallel opt-ins, and neither one
supersedes the other.
Pitfalls¶
Bind the alias, do not edit the struct. Overriding
config_tis a supported target-configuration change; editingdefault_config_tin place puts your build on a fork of the library.kCacheLineBytes = 0is a legal value. It means “this target has no second core to false-share with”, and it is an optimization knob in both directions — never a correctness one.A
config_reader_tborrows. The reader and everystd::string_viewit returns point into the bytes itstlv_node_tborrows; both die with those bytes.Ignoring an unknown key is deliberate. A reader that rejects settings it does not recognize breaks forward compatibility with a newer peer. This is the opposite ruling from
parse_acl, which rejects an unknown key: an ACL is a security document, where silently dropping an attribute widens access. The tolerance is safe here only because the skip takes the whole pair.
API reference¶
-
struct default_config_t¶
The target’s build configuration, as ONE named type (ADR-0070).
Every compile-time knob is a member here, and the loose names below are DERIVED from it. That ordering is the point: the configuration is a single diffable entity an application can name, pass to a test, and assert on — rather than a scatter of independent declarations that can only be read one at a time.
It is bound once per build, not threaded as a template parameter. ADR-0070 records why, with measurements: threading it produces byte-identical machine code (verified across eight knob combinations, five optimization levels and two targets), so it buys no latency; its one unique capability — two configurations in one binary — would FORK the process-global stripe and hazard tables, costing exactly the RAM the configuration exists to save; and an app-declared traits type cannot reach the library’s out-of-line translation units anyway, so it would layer on this header rather than replace it.
Declaring your own. Write a
libtracer/config_override.hppand put its directory ahead ofcore/includeon the include path. This header includes it — after this struct, so the defaults are already visible to inherit from — and uses whatever config_t it binds:// libtracer/config_override.hpp #pragma once namespace tr::graph { struct my_node_config_t : default_config_t { static constexpr std::size_t kCacheLineBytes = 0; // single-core: no false sharing using guard_t = my_rtos_critical_section_t; }; using config_t = my_node_config_t; } // namespace tr::graph
Inheriting from default_config_t means a knob added later does not break your preset — it inherits the new default instead of failing to compile. Stating only the differences is also what keeps the override honest: there is no second copy of the defaults to rot.
Public Types
-
using size_classes_t = size_class_ladder_t<16, 8, 65536, 48>¶
The ladder that generates the default default_config_t::kSizeClasses. A classed root whose table is this one finds a class by its arithmetic
ceiling(#2143).
-
using acl_policy_t = allow_only_policy_t¶
The target’s selected ACL policy (ADR-0047 §1 build-time module set).
Default: the ALLOW-only MCU profile. A host binds the full
security_aclpolicy (ordered first-match-per-bit with DENY) in its override fragment — a target-configuration change, never an edit tograph.cpp. Override fragment:using acl_policy_t = full_acl_policy_t;. (The-DLIBTRACER_ACL_FULLCMake option that used to write that line was removed in #1722; configuring with it is an error.)
-
using guard_t = ::tr::mutex_guard_t¶
The target’s ONE critical-section type (RFC 0028 §5.5): the guard
single_writer_slot_topens around its pointer swap and its handle copy, AND the defaultSyncpolicy oftr::mem::synchronized_pool_t.One trait, not two: before slice 10 the pool had its own
pool_sync_policyvocabulary (spin_sync_t/portmux_sync_t), bound separately from this one. It must modeltr::guard(guard.hpp):lock()/unlock(), a staticfor_address(const void*)the slot takes, and theis_isr_safe/is_nonblocking/may_spin/nametraits. It also serializes atr::rmw_counter_tbump on a core with no atomic read-modify-write.Spelled
reader_guard_tuntil #1703. A fragment that still defines that name is refused at compile time (see the tripwire after config_t), because a fragment whose binding the library no longer reads would fall back tomutex_guard_twithout a word.mutex_guard_tby default: a table of address-striped one-word locks — one RMW to take, a release store to give back — whose contender re-reads briefly and then sleeps instead of spinning on a descheduled holder; unrelated vertices rarely share one. A single-core RTOS build binds an interrupt-masked critical section (the ESP-IDF component:tr::esp::critical_guard_t). The guard must never spin-wait where kSpinWaitSafe isfalse— that is the whole of #1618 — and a guard that declaresmay_spinis refused there by both the slot and the pool.
-
using fault_sink_t = ::tr::stderr_fault_sink_t¶
Where core reports a setup-time sizing fault before it aborts (#1885).
Core has one such report: a memory source or the vertex ceiling refusing a call that initialization cannot do without (ADR-0056 amendment, ADR-0083). It hands the facts (
tr::init_fault_t) tofault_sink_t::reportand aborts when that returns, so core itself writes to no stream. The host default prints one line onstderr; a target with no stdio bindstr::silent_fault_sink_tor its own type with the same staticreport. Override fragment:using fault_sink_t = my_uart_fault_sink_t;.
-
using sync_t = ::tr::std_sync_t¶
The target’s BLOCKING primitives (#2454): the mutex, shared mutex and condition variable every control-plane section and teardown drain sleeps on.
Not the guard_t, whose window is a few instructions and, on a chip, masks interrupts, so nothing may block inside it. These are held across work that can block (a send, a dial, a drain) and are waited on. The binding is a policy type naming three members,
mutex_t,shared_mutex_tandcondvar_t, whichsync.hpplifts totr::mutex_t,tr::shared_mutex_tandtr::condvar_t; core names nothing else.condvar_twaits on astd::unique_lock<mutex_t>.std_sync_tby default:std::mutex,std::shared_mutex,std::condition_variable. Every ESP-IDF chip target bindstr::esp::static_sync_tinstead, because there each standard primitive is a pthread object whose FreeRTOS semaphore the IDF pthread layer draws from the platform heap, out of the archive’s sight; the static spelling holds its semaphore inline and allocates nothing. Override fragment:using sync_t = my_rtos_sync_t;.
-
using frame_observer_t = ::tr::net::no_frame_observer_t¶
What the router tells about each inbound frame before it routes it (#2580): the name of the link the frame arrived on, and nothing else.
fwd_router_tcallsframe_observer_t::on_frame(inbound_link_name)once per inbound frame, on every link, before dispatch, on the receiving task, including a frame that dispatch then refuses or drops. A frame on a bus whose peer the link cannot name has no name to give, and is dropped unobserved; a frame the node originates itself arrived on no link and is not observed either. The call gets no frame bytes, and the name view is valid only for the duration of the call. It is observe-only: it returns nothing, so it cannot refuse or alter the frame, and it must benoexcept. It runs on the receiving task, so it must not block. Its use is per-link liveness and traffic accounting kept in the application. The router holds no state for it, so whatever the policy keeps lives in the policy itself.The default,
tr::net::no_frame_observer_t, does nothing and compiles away: a build that does not name a policy pays nothing. Override fragment:using frame_observer_t = my_link_tally_t;, wheremy_link_tally_thasstatic void on_frame(std::string_view link) noexcept.
-
using lkv_slot_t = single_writer_slot_t¶
The target’s selected LKV slot policy (ADR-0069 §1).
How a vertex publishes and reads its last-known value. Default:
single_writer_slot_t, onevalue_t*swapped and retained inside guard_t. It has no registry, no deferred reclamation and a publish that cannot fail, and its one wait is the guard (#1618).hazard_slot_tis the lock-free opt-in. Target: a WIDE many-core host. Precondition: many readers contend on one hot vertex. A single core gains almost nothing from it and publishes slower, so a NARROW or MID build keepssingle_writer_slot_t. This axis is independent ofreclaim_policy_t: binding one says nothing about the other. Override fragment:using lkv_slot_t = hazard_slot_t;. The named type must satisfy the contract inlkv_slot.hpp— in particularload()returns an OWNING handle, and the policy declaresmay_spin, which is refused where kSpinWaitSafe isfalse.
-
using reclaim_policy_t = reclaim_qsbr_t¶
The target’s selected RECLAMATION policy (ADR-0080) — WHEN the library may free the memory behind a retired subscription’s
{fn, ctx}pair.Default, on every target:
reclaim_qsbr_t, whose grace point is “every dispatching
thread has passed a quiescent state” (ADR-0080 Amendment 1 §1, #2127). A retired pair is released inline when no participant is mid-dispatch (the ordinary case) and otherwise by whichever participant completes the grace period, so the release hook may run on a thread other than the
unsubscribe()caller and must be short, thread-safe and non-blocking — seereclaim.hpp. It prices one relaxed load, one release store and one fence per OUTERMOST bracket (not per edge; the fence is a compiler barrier underkSingleCore).The one opt-out:
using reclaim_policy_t = reclaim_strict_t;, which tracks nothing and releases inline beforeunsubscribe()returns. Target: NARROW bare metal. Precondition, a hard rule: no preemption and no second core, becausereclaim_strict_tcannot detect a violation and preemption alone reproduces the use-after-free. A single-core RTOS keeps the default. This axis is independent oflkv_slot_t:hazard_slot_tis a WIDE opt-in on that axis, not an alternative to this one.reclaim_local_tis withdrawn: a fragment that still names it is refused with the migration note.
Public Static Attributes
-
static constexpr std::size_t kVertexLockStripes = 16¶
The number of lock stripes shared by every vertex in the process (#361 §2).
Override fragment:
static constexpr std::size_t kVertexLockStripes = 8;; ESP-IDF: menuconfigCONFIG_LIBTRACER_VERTEX_LOCK_STRIPES, which writes exactly that line. A small single-core node reclaims RAM at 4-8.What N costs, precisely:
N * sizeof(vertex_stripe_t)bytes of.bssreserved at LINK time (plus the same for the condvar table) — the table is not lazy, whatever the platform does, and it holds the whole of each stripe’s mutex: on an ESP-IDF chip that is the FreeRTOS semaphoretr::esp::static_mutex_tkeeps inline (#2454), never a heap draw on first lock. Elsewhere most of the struct is padding, and kCacheLineBytes decides how much. On esp32c6 a stripe is 92 B plus its 16 B condvar, so 16 stripes are 1,728 B; the ESP-IDF component defaults a single-core chip to 4 (432 B).
-
static constexpr std::size_t kParkStripes = 8¶
Stripes in the park table
tr::park_wait/tr::park_wakesleep on (#2507).Each stripe is one
tr::mutex_tand onetr::condvar_t, reserved in.bssat link time once anything parks: 100 B a stripe on esp32c6 (#2454), a few dozen on a host. A word that shares a stripe with another costs a spurious wake and a re-check, never a lost one, and only contended and teardown paths park, so a small table costs little. Override fragment:static constexpr std::size_t kParkStripes = 4;; ESP-IDF: menuconfigCONFIG_LIBTRACER_PARK_STRIPES.
-
static constexpr std::size_t kCacheLineBytes = 64¶
The target’s cache-line size for false-sharing padding — or 0 where false sharing cannot happen, because the target has no second core to share with.
libtracer pads the shared tables whose slots unrelated threads hit concurrently (the vertex lock stripes; the hazard domain’s cells and retire lists) up to this boundary, so two threads working on two slots never fight over one line. On a single-core node that padding buys nothing and the bytes are pure loss: measured on rv32 (
-Os, realcore/src/graph.cpp, GCC 15.2), 16 stripes cost 1,024 B of at 64 and 128 B at 0 — 896 B of a single-core node’s static RAM spent against a hazard it does not have.This is an OPTIMIZATION knob, never a correctness one: 0 on a multi-core target costs throughput under concurrent control-plane verbs and changes no observable behaviour. Override fragment:
static constexpr std::size_t kCacheLineBytes = 0;. The ESP-IDF component derives it fromCONFIG_FREERTOS_UNICORE— a unicore build has no second core by construction, so the right value is not a question the integrator should be asked.Values below a padded type’s natural alignment are raised to it, not applied ([dcl.align]/5 makes a reduction ill-formed, and GCC ignores it silently); each padded type static_asserts that the alignment it asked for is the one it got.
-
static constexpr std::size_t kCrc32cSlices = 8¶
How many 256-entry tables the portable CRC-32C fold reads per step: 8 (slice-by-8, 8 KiB of
.rodata) or 1 (the byte-at-a-time Sarwate loop over the 1 KiB base table the constant-evaluated CRC already uses).Only the no-hardware path reads it: x86 with SSE4.2 and ARMv8 with the CRC extension fold in the instruction and never touch either table. Every value produces the same CRC, byte for byte (a frozen-vector requirement), so this is an optimization choice, never a correctness one.
The default is 8 on every target: a MID or WIDE node with no CRC instruction (an rv32 ESP32-C6, a 32-bit Linux board) keeps the fast fold on every frame. A NARROW node binds 1 explicitly; on the Cortex-M0 P0 node the seven extra tables were 7,168 B of its 16 KiB flash budget (#2116), and the footprint sentinel’s fragment pins that choice. The trade, indicative only (one isolated run of the portable fold under
nice, host x86-64, GCC 13.3,-O2): slice-by-8 folds 1.1 / 2.3 / 2.2 GB/s at 64 B / 1 KiB / 16 KiB, the single table 0.33 / 0.40 / 0.44 GB/s, about 3.4x to 5.6x slower. Override fragment:static constexpr std::size_t kCrc32cSlices = 1;.
-
static constexpr std::size_t kHazardReaderSlots = 64¶
How many threads may hold a hazard announcement at once (ADR-0069 §3).
Read this as “threads that concurrently touch a vertex’s LKV” — readers announce, writers park displaced nodes, and both claim one index for the life of the thread. A per-target knob rather than a thread ceiling picked out of the air (RFC-0006); override fragment:
static constexpr std::size_t kHazardReaderSlots = 24;.Sizing: one index per such thread, and nothing at all unless lkv_slot_t is bound to
hazard_slot_t— the default binding (single_writer_slot_t) never references the registry, so it is never emitted. Undersizing is not a correctness problem: threads past the bound share one reserved index under a spin lock, so they serialize with each other and with nobody else.What the domain costs when it IS bound, measured on rv32 at N = 64 (
-Os, realcore/src/graph.cpp, GCC 15.2) — the padding knob dominates it:registry
.bssTU
.bss+.sbss64
8,384 B
11,649 B
0
1,828 B
4,197 B
Note the third term the registry figure does not cover: binding the slot also pulls in roughly 2 KB of libstdc++
__waiter_pool_base.bss(theatomic::waitback-end), which is why the TU column is not just the registry plus the stripes.
-
static constexpr std::size_t kInlineFanout = 8¶
Subscribers a publish snapshots into its stack buffer before it falls back to the overflow vector (#1708) — a TUNING knob, never a limit.
A publish copies the vertex’s live edges into a fixed buffer of
edge_view_ton its own stack, so a fan-out up to this width reaches no allocator. A wider fan-out snapshots into a frame of eight times this width on the same stack, and past that into a block from the graph’s table source (#1885), and delivers to every subscriber exactly as before: the width selects a strategy, it refuses nothing and reports nothing. Only a table source that refuses the block sheds the tail, as a countedfan_out_truncateddrop.The buffer is reserved on EVERY publish frame whether the vertex has one subscriber or eight, at
kInlineFanout * sizeof(edge_view_t)bytes: 384 B on a 64-bit host (48 B a view) and 224 B on rv32 (28 B). The wide fan-out’s frame sits in the same stack frame at eight times that (#1885): 3,072 B on a 64-bit host, 448 B on rv32 at 2. The host default keeps the allocation-free fast path for the widths the benches gate; a NARROW node whose vertices carry one or two subscribers spends that stack on every task that publishes. Measured on rv32 after #1885 (-Os, GCC 15.2, realcore/src/graph.cpp,-fstack-usage, #1912):graph_t::fan_out’s frame (its outlined body,fan_out.part.0) is 2,128 B at 8 and 608 B at 2. The difference, 1,520 B, is the six inline views (168 B) plus the 48 views the wide frame loses (1,344 B) and 8 B of frame rounding. Before #1885 it was 304 B at 8 and 128 B at 2. Override fragment:static constexpr std::size_t kInlineFanout = 2;— the ESP-IDF component sets 2 on a chip target. At least 1.
-
static constexpr std::size_t kEdgePinSlots = 32¶
How many threads may hold an EDGE PIN at once (#635) — the per-participant announcement the fan-out snapshot claims while it copies a vertex’s published edge array out.
Read this as “threads that may publish (`graph_t::write`) concurrently”. Each claims one index for the life of the thread; the pin itself is held only across the copy-out, never across a dispatch. A per-target knob rather than a thread ceiling picked out of the air (RFC-0006); override fragment:
static constexpr std::size_t kEdgePinSlots = 24;.Correctness never depends on this number — only scaling does. A thread that finds every index taken falls back to copying the CURRENT array under the vertex stripe mutex, which is safe for the reason the mutex existed in the first place: displacing an array requires that same lock, so the current array cannot be retired underneath the fallback reader. Undersizing costs those threads exactly what every thread paid before #635.
Unlike kHazardReaderSlots this registry is ALWAYS emitted — the publish path is not a policy binding. Its
.bssisN * max(kCacheLineBytes, alignof(void*))bytes: at N = 32 that is 2,048 B on a host (64-byte padding) and 256 B on a single-core MCU profile, which sets kCacheLineBytes to 0 and has no second core to false-share against.
-
static constexpr std::size_t kMaxVertexBytes64 = 64¶
The RAM-diet RATCHET on
sizeof(vertex_t), 64-bit targets (#361 §8).Pinned to the size actually measured, with NO headroom, so the next byte added is a build failure. That is the point: the goal is a lean vertex, and a ceiling held above the measured size cannot express it. A ceiling only answers “did you regress past a
fixed point”; both 112 B and 96 B satisfied the old 120 B ceiling, so the 16 B the diet won after #380 §1 were invisible to the build and free to be spent again by anyone. Pinned to the measurement, every byte reclaimed is kept by construction.
History, newest first: 64 (#2673 — the 4 B own-subscriber count moved into the edge block, and the 4 B of tail padding it left went with it), 72 (#2672 — the 24 B inline name key became an 8 B pointer into the graph’s name block plus one word packing its length and the slot memo: 12 B saved, 8 B of it after alignment), 80 (#2655 — the write sequence is deleted: its 4 B and the 4 B of tail padding it left; every CI preset agrees), 88 unchanged by #1621 (the 32-bit write sequence frees 4 B that the member order’s tail padding absorbs on a 64-bit host), 88 (RFC-0028 slice 3 — the LKV slot is one
value_t*word, where thestd::shared_ptr<const rope_t>it replaced was two; bothlkv_slot_tbindings agree), 96 (measured across all three CI legs —acl_fullOFF/ON and bothlkv_slot_tbindings agree), 112 post-#380 §1, 144 post-packing, 168 post-§3, 160 post-§2, 248 post-§1, 536 pre-split.It lives HERE, in the configuration, because it is a per-target budget — and it is enforced in
vertex.hppbeside the type it constrains, so every build on every target evaluates it under its own binding. It used to sit in a test, which meant it gated exactly one configuration and never the 32-bit one at all (no CI leg compiled that test cross-target, while the ESP-IDF legs compiledvertex_titself on every PR).Two rules follow from pinning it. RAISING one is a reviewed decision, never a way to make a build pass. LOWERING one is the routine half: a change that shrinks
vertex_tlowers the number in the same commit, or the gain is handed back to the next author.
-
static constexpr std::size_t kMaxVertexBytes32 = 40¶
The RAM-diet RATCHET on
sizeof(vertex_t), 32-bit (MCU) targets.Pointer-halved, and pinned to the measurement on the same terms as kMaxVertexBytes64 — measured 40 B on rv32 (
-Os -fno-exceptions -fno-rtti,rv32imac_zicsr_zifencei/ilp32;rv32imcagrees).Lowered 44 -> 40 by #2673: the own-subscriber count moved into the edge block, which only a subscribed vertex has (x86-64: 72 -> 64, the 4 B taking the alignment tail with it).
Lowered 60 -> 44 by #2672: the 24 B inline name key (16 B buffer, length, slot memo) became a 4 B pointer into the graph’s name block plus one word holding the length and the slot memo.
Lowered 64 -> 60 by #2655: the write sequence is deleted (await wakes by unlinking its waiter), taking its 4 B with it.
Lowered 72 -> 64 by #1621 (RFC-0028 D6):
write_seq_became a 32-bit atomic. The 64-bit one was 8 B wide AND 8-aligned on rv32, so it cost 4 extra bytes plus 4 of alignment padding, and a libatomic call (__atomic_fetch_add_8, which masks interrupts on ESP-IDF) on every publish.This number was 80 with a note claiming rv32 was “exactly 80” and had zero headroom. It was 72 by then: the struct had shrunk and the prose had not, which is exactly the drift a pinned number cannot have — the assert is re-derived from a measurement, while a sentence describing the size is only as true as the day it was written.
Earlier: raised 72 -> 80 with the #380 §2 name-key SBO, whose inline buffer adds <= 8 struct bytes on 32-bit but deletes a ~32 B heap block per named vertex — and on this target the heap is what is actually scarce.
The copy-or-share hint a vertex that declares none answers (RFC-0022 Amendment 3, #2226): a build-wide share_hint_t.
DEFAULT, the default, follows the build’s block source (tr::mem::share_fits): the static arena and the heap root share a trailer-less written value, the slab pool shares it on a class fit.COPYmakes copy the build’s posture, so a long-lived value (a knob, a setting) never holds a pooled receive block for its whole life and only the vertices that declareshare_hint_t::SHAREkeep theirs;SHAREshares wherever the value sits in one block. A vertex’s own declaration wins over it, and one that declaresDEFAULTgets this value.Compile-time, like every member here: the read is one constant fold, so at
DEFAULTthe write path compiles to what it was without the knob. Override fragment:static constexpr share_hint_t kDefaultShareHint = share_hint_t::COPY;.
-
static constexpr auto kSizeClasses = size_classes_t::kTable¶
The size-class table of the host slab pool (ADR-0083 Decisions 4 and 5, #1775, #1777): the block sizes a class serves, ascending.
The host default root (
mem_slab_pool.hpp,tr::mem::host_root_t) carves every block it serves from a slab of one class: a request takes the smallest class that holds it, and the host allocator sees only whole slabs. A size-class boundary is therefore a row in this one table, not a property of the platform allocator. That is what removes the 1 KiB cliff #1768 measured: a 1024 B value’s 1072 B one-block segment is a 1152 B block here, from the same per-thread cache a 1000 B one comes from, where glibc served it on a slower path than a 1032 B request.Default: 16 B to 64 KiB, 8 classes per doubling, plus one for a 64 KiB payload’s segment. Eight classes of 16 B up to 128 B, then eight evenly spaced classes in every doubling above it (144 … 256, 288 … 512, … 61440, 65536), so no block wastes more than one eighth of its size; then 65584, a 64 KiB payload with the 48 B header of its one-block segment on a 64-bit host (#1990), where it would otherwise have fallen to the root at about twice the cost of a classed draw. 81 rows. A class takes no memory until its first request, so the extra row costs a node that never holds a 64 KiB value only its table entry. A request above the last row, or one aligned past 64 B, is drawn from the root as whole slabs of its own (kSlabBytes multiples) and returned there when freed.
Every row must be a multiple of 16 (
alignof(std::max_align_t)on the reference hosts), so every block keeps the platform allocator’s alignment, and the table must be non-empty and strictly ascending, with at most 255 rows; the pool asserts all three. A node whose payloads cluster (mostly 4 KiB frames) states its own table, and pays no slab for a class it never draws: a class takes its first slab on its first request.Where kSlabPool is
falsethe same table sizes the static arena’s classes instead (kArenaBytes): a block takes the smallest row that holds it there too, from that row’s free list.Override fragment:
static constexpr std::size_t kSizeClasses[] = {64, 256, 1024, 4096};.
-
static constexpr bool kSlabPool = true¶
Whether this build’s default root is the host slab pool (ADR-0083 Decision 4, #1777).
true(the host default): agraph_tbuilt without a source derives its value, table and net sub-pools fromtr::mem::host_root(), andtr::mem::heap_backend(),value_source(),table_source(),net_source()andnet_backend()all draw from them. The host allocator then serves whole slabs only (kSlabBytes), never a request per value.false(the MCU default, ADR-0083 Decision 4, #1783): the default root is a STATIC ARENA of kArenaBytes (mem_arena.hpp,tr::mem::arena_root_t), carved into the classes of default_config_t::kSizeClasses, and the same five defaults draw from its value, table and net sub-pools. No byte of the default root comes from a heap; the arena never trims, and an exhausted arena refuses (BACKPRESSURE at run time, a sizing abort at init). A target with a few hundred KiB of RAM gains nothing from 64 KiB slabs, so the ESP-IDF component bindsfalse. Until v0.19.0 this setting meant the platform heap; an application that still wants that injectstr::mem::heap_source()into itsgraph_t.Override fragment:
static constexpr bool kSlabPool = false;.
-
static constexpr std::size_t kArenaBytes = 32768¶
The static arena’s size in bytes, where kSlabPool is
false(ADR-0083 Decision 4, #1783).The MCU default root is one array of this many bytes in
.bss, so the linker map shows exactly what the library holds by default. Every sub-pool carves from it, and nothing it carves goes back to it: a block returned to a class is reused by that class only. Size it against the node’s peak per class (:stats.mem.values,.tablesand.netreport each sub-pool’s high-water mark, and the root’s census the bytes carved). An application that injects its own root into everygraph_tcan bind a small value; the defaults that take no graph (tr::mem::value_source()and its siblings) still draw here. With every source injected (the graph’s root, the router’s planes, the transport vertex’s rx and egress stores), a long vertex name, a connection’s liveness value, a bus link’s:children[]listing and a composed field read’s value block draw nothing here (#2052): the arena’s minimum is 0 B. Measured on a bus connection created, published UP and listed with two peers: 288 B carved before #2052, 0 B after, on Cortex-M0 and on ESP32-C6.0 opts out of the arena (#2090): the platform heap becomes the default root. No region, no free-list heads and no root object are compiled, so the default root costs no static byte, and
tr::mem::default_root(),value_source(),table_source()andnet_source()aretr::mem::heap_source(),heap_backend()andnet_backend()the platform heap. The trade-off: every default the application has not redirected draws from the heap, unbounded, and the no-heap link check (ADR-0083 Decision 1) does not hold for that image; it is a deliberate exception for an application that injects its own sources everywhere. A nonzero value is at least the smallest row of default_config_t::kSizeClasses.The free-list heads are sized from the region: one per sub-pool per row of default_config_t::kSizeClasses no larger than this (
tr::mem::kArenaClasses), since a larger class could never be carved.Not read where kSlabPool is
true: no arena is compiled there.Override fragment:
static constexpr std::size_t kArenaBytes = 65536;, or= 0;for the heap-rooted build.
-
static constexpr std::size_t kThreadStackArenaBytes = 0¶
Bytes of the static THREAD-STACK arena behind
tr::mem::stack_source()on a build whose kSlabPool isfalse(#2288); 0 = none.Every library thread is a
tr::static_thread_t. On ESP-IDF its stack and task block are one block from the link’slink_memory_t::stack, whose default istr::mem::stack_source(). A nonzero value gives those defaults a static region of their own, apart from the value/table/net arena of kArenaBytes, so a thread spawn can never starve the value and table pools, and the reverse. The region holds whole stacks: a released stack is reused by the next request of the same size. At 0,stack_source()istr::mem::default_root().Not read where kSlabPool is
true: a host thread’s stack is the platform’s mapping, and its source pays only a boot record.Override fragment:
static constexpr std::size_t kThreadStackArenaBytes = 16384;.
-
static constexpr std::size_t kSlabBytes = 65536¶
The slab the host slab pool draws for a class, in bytes: the smallest unit it asks the root for (#1777). A power of two.
A class draws a slab of this size, or the next power of two that holds 8 of its blocks if that is larger, aligned to its own size, so a block finds its slab by masking its address. A slab is carved lazily, one block at a time, so its untouched pages cost the node address space and not resident memory. Default 64 KiB: one slab holds 8 or more blocks of every class up to 7 KiB.
Override fragment:
static constexpr std::size_t kSlabBytes = 16384;.
-
static constexpr std::size_t kSlabClassCap = 2¶
The fully free slabs a host slab-pool class keeps (ADR-0083 Decision 6, #1777).
A slab whose last block comes back is RELEASED to the root when its class already keeps this many fully free slabs, and kept for the next burst otherwise, however many slabs of the class are live, so a long-running service gives back what a burst took instead of holding its peak forever. Nothing is released on a timer (there is none in the library):
tr::mem::host_root_t::trim()releases every fully free slab on the application’s own schedule. At least 1, so a class that alternates one allocation and one free does not draw and release a slab each time.Override fragment:
static constexpr std::size_t kSlabClassCap = 1;.
-
static constexpr std::uint8_t kReadBudget = 0¶
How many READs one session may send in a run while another session reads too (#2774); 0, the default, turns the budget off and compiles it away.
When several sessions READ one node at once, each READ is served in arrival order, so a session that reads now and then waits behind sessions that read in bursts. With a budget N, a READ this node terminates is answered
tr::flow::backpressure(the existing reply) when it is beyond the session’s N-th in the current run AND at least two sessions have READ in that run. A session alone in a run is never refused, and neither is a WRITE, a subscribe, an AWAIT, a REPLY, or a frame this node forwards.The application closes a run by calling
fwd_router_t::close_read_runfrom any task or timer on its own clock, e.g. every 100 ms; a starved idle task stretches the run, and the budget with it. The library reads no clock (no timers in libtracer). A session is one slot of a stream server (TCP, WS, the ESP-IDF WS link) or a whole link otherwise, and its count lives in that slot (receiver pays). At 0, every tally member is an empty[[no_unique_address]]type and the check is not compiled: 0 bytes, no branch.The census counts sessions that READ in the run, not sessions still connected: a session that READ and left still counts until the run closes, so a newcomer that is alone past its N-th READ may be refused for the rest of that run.
Override fragment:
static constexpr std::uint8_t kReadBudget = 3;. At most 254.
-
static constexpr std::size_t kMaxAwaitsPerLink = 8¶
A per-link bound on parked waiters: how many deferred remote AWAITs one link may hold at once (ADR-0084 §Decision 2, #2902).
A waiter is one block of the router’s shared link plane, so the most that plane holds for AWAITs is links × this cap × one waiter block, which the embedder sizes. An AWAIT beyond the cap on its link is answered
tr::flow::backpressureat once and counted infwd_router_t::await_refusals; other links still park. The bound costs no byte per link: the router counts a link’s waiters by walking its list, and only once the router as a whole holds this many. Must be at least 1.Override fragment:
static constexpr std::size_t kMaxAwaitsPerLink = 4;.
-
static constexpr std::size_t kGuardStripes = 64¶
Locks in the host guard’s process-wide stripe table (#1716); a power of two.
Applies when the build keeps the default guard_t, and then the library then binds
tr::basic_mutex_guard_t<kCacheLineBytes, kGuardStripes>, so the table costskGuardStripes * max(kCacheLineBytes, 1)bytes of.bss— 4 KB at the defaults. Two vertices share a lock only when their addresses hash to one stripe, and a shared stripe costs a contended section, never correctness. Override fragment:static constexpr std::size_t kGuardStripes = 16;. Ignored when guard_t is bound to anything else (an interrupt-masked guard has no table).
-
static constexpr std::size_t kDeferredReleaseSlots = 16¶
How many retired
{ctx, release}pairs the QSBR domain may hold at once, waiting for a grace period (ADR-0080).The pairs are held across a cross-thread GRACE PERIOD in ONE shared table, so the quantity this bounds is “retirements in flight process-wide while some participant has yet to
quiesce”. The ordinary unsubscribe, with no participant mid-dispatch, holds nothing: its hook runs inline. Raise it (64 is a sane starting point) on any node that unsubscribes in bulk while other threads dispatch. Nothing at all under
reclaim_strict_t, which never defers.Sizing: each slot is a handoff word, the
{ctx, release}pair and its epoch, in.bss, with no destructor and no allocation: 32 B on a 64-bit host and 16 B on a 32-bit MCU, so the default 16 slots cost 512 B and 256 B. Now thatreclaim_qsbr_tis the default on every target (#2127), size the table for the largest burst of unsubscribes that can overlap another thread’s dispatch, not for the steady state: one slot per subscription a node may retire while some participant is still inside a fan-out. A single-threaded node, or one that unsubscribes only while no other thread dispatches, retires inline and never holds a slot. A node that tears down a whole subtree under live traffic wants the subtree’s subscription count here. Watchgraph_t::reclaim_refusals().release_refusedin a soak: any non-zero reading means the bound is too small for that deployment.Overflow is a REFUSAL, not a failure: a pair that finds every slot taken is DROPPED and its hook is never run — a leak, deliberately, because the alternative is running a release hook while a fan-out that is still walking the snapshot names that context. A full table is drained and scanned again before a pair is refused, so a drop means the table is full of pairs some participant still holds: either one participant has not reached a quiescent state, or a burst of retirements outran the table while participants were still inside their fan-outs. The
unsubscribeanswersBACKPRESSUREandgraph_t::reclaim_refusals()counts every one (release_refused), so an undersized bound is observable rather than silent. The transport plane’s join notice is never refused: it takes over an occupied slot instead (detail_qsbr::retire_onto, #2840), and retries only while every slot is mid-fill or mid-drain on another thread. So the bound must exceed the number of threads that can be preempted in such a step while a plane is destroyed. Override fragment:static constexpr std::size_t kDeferredReleaseSlots = 64;
-
static constexpr std::size_t kQsbrParticipants = kEdgePinSlots¶
How many threads may participate in the
reclaim_qsbr_tgrace period at once (#1376) — the per-thread quiescent-state announcement a retiring thread scans.Read this as “threads that may dispatch (`fan_out`, or an ADR-0049 durability latch)
concurrently”. Derived from
kEdgePinSlots rather than picked out of the air, the way’slkv_slot.hppkRetireBatchis derived from kHazardReaderSlots — the two sets are the same threads, since a thread that publishes is a thread that dispatches.The derivation follows the config the build binds (#2111): a fragment that sets kEdgePinSlots and leaves this knob alone gets that many participants, not this struct’s 32. A member initializer here cannot see a derived struct’s value, so the namespace-scope
tr::graph::kQsbrParticipantsmakes the choice, throughqsbr_participants_v: the bound config’s ownkQsbrParticipantswhen it declares one, else itskEdgePinSlots.The two sets are not quite the same: a transport’s receive thread opens the router’s frame bracket, and so takes a cell, without ever taking an edge pin. A node with more receive threads than publishing ones should declare this knob rather than rely on the derivation.
**Unlike kEdgePinSlots, correctness is not indifferent to this number** — but it fails SAFE, not silently. A thread that finds every index taken cannot announce itself, and a thread a scan cannot see is one no grace period may conclude past; so it counts itself into an overflow tally instead, and any non-zero reading blocks all reclamation until it clears. The failure mode is therefore deferred frees (visible as tr::graph::graph_t::reclaim_refusals rising), never a use-after-free.
Its
.bssisN * max(kCacheLineBytes, alignof(std::uint32_t))bytes, the floor being the 31-bit epoch’s state word: at N = 32 that is 2,048 B on a host. The transport plane uses the same cells in every build (fwd_router_tbrackets each inbound frame and origination with them), so a build with the router carries this.bssunder either policy; a thread that finds every index taken still fails safe, deferring the free of a removed link. The retired table is a separate object that onlyreclaim_qsbr_tnames, so the linker drops it from areclaim_strict_tbuild. Override fragment:static constexpr std::size_t kQsbrParticipants = 64;
-
static constexpr bool kQsbrAsymmetricFence = false¶
Whether a frame bracket’s entry announces itself with a plain store, leaving the full barrier to the reclaim side’s
membarrier(2)(the asymmetric fence).With it,
detail_qsbr::enteron a Linux host stores its cell with no fence; the reclaim side, before a scan may conclude that a grace period has passed, makes every running thread of the process execute a full barrier (MEMBARRIER_CMD_PRIVATE_EXPEDITED), so the store-load ordering the entry’sseq_cstfence gave is paid once per freeing scan, not once per frame. The proof is in, section “The asymmetric fence”. It applies only where the target hasqsbr.hppmembarrier: on any other target (ESP-IDF, Cortex-M0, any non-Linux host) the entry stays the store andseq_cstfence, whatever this says. On Linux, a process whose registration is refused (an older kernel, a seccomp filter) also keeps the fenced entry.Off by default: the fenced entry costs about 2 ns per outermost bracket on an x86 host, while every
membarrierinterrupts each running thread of the process and costs the reclaimer tens of microseconds. A node that churns hooked subscriptions or removes links pays far more on the reclaim side than it saves on frames (#2100 has the numbers). Opt in on a read-mostly host node, where frames outnumber reclaim events by tens of thousands to one. Under it, drain passes run single-flight: a drainer that finds another one fencing skips its pass, which only defers a free. Override fragment:static constexpr bool kQsbrAsymmetricFence = true;
-
static constexpr bool kSingleCore = false¶
Whether this build runs on ONE hart: every thread that touches the library shares a single core, so the QSBR bracket’s fences become compiler barriers.
A correctness fact, not a tuning knob, and it fails safe to false. Under it the frame bracket’s entry and exit are plain stores with a compiler barrier (no
fenceon rv32, nodmbon Cortex-M), and the reclaim side’s fence is a compiler barrier too. The argument is the single hart’s (, section “The single-hart flavour”): one instruction stream, and a context switch is a precise trap, so a descheduled task’s accesses are all performed before the next task’s first instruction. Setting it on a build that runs on more than one core removes fences the grace-period proof needs, which is a use-after-free.qsbr.hppEach integration derives it from a build fact and never asks: the ESP-IDF component from
CONFIG_FREERTOS_UNICORE(on a chip target), a Zephyr integration from!CONFIG_SMP, a bare-metal board preset by itself. It is never inferred from kCacheLineBytes (a padding knob an integrator may zero to save RAM) or from the target triple (a dual-core part shares an architecture with a single-core one). It wins over kQsbrAsymmetricFence, which then has nothing left to save. ADR-0080 Amendment 1 §2 (#2126). Override fragment:static constexpr bool kSingleCore = true;
-
static constexpr std::size_t kDeviceBackendSlots = 2¶
How many
DEVICE-space memory backends may register a transfer hook at once (#1381) — the bound ontr::mem::register_device_backend’s table.An L0 (
tr::mem) fact, here for the same reason kSpinWaitSafe is: ADR-0070’s rule is that the configuration is ONE named type. tr::mem::kDeviceBackendSlots is its spelling for the memory layer.Read it as “vendor accelerator backends this process binds” — a GPU tier module, an NPU one, a dmabuf one. Two is the honest default: a host that talks to one accelerator family needs one slot, and nothing in-tree registers at all.
Its
.bssisN * (sizeof(void*) + sizeof(void(*)()))— 32 B on a 64-bit host at the default — and it is emitted only in a build that linksdevice_backend.cpp. A single-backend (LIBTRACER_BACKEND_SET_POOL_ONLY) target has no device arm and never links that TU, so the cost there is 0 B rather than “small”. Override fragment:static constexpr std::size_t kDeviceBackendSlots = 4;Overflow is a REFUSAL, not a failure:
register_device_backendreturnsfalseand registers nothing, so a backend that could not claim a slot moves no bytes at all (tr::mem::transferanswersfalsefor its segments) rather than silently sharing another vendor’s hook.
-
static constexpr bool kSpinWaitSafe = true¶
Whether a task on this target may SPIN-WAIT for a lock another task holds (#1158).
An L0 (
tr::mem) fact, but a member HERE because ADR-0070’s rule is that the configuration is ONE named type: a knob that lives outside it cannot be set by an override fragment, which is exactly the defect that kept this one in the build system. tr::mem::kSpinWaitSafe is its spelling for the memory layer, derived like every other loose name below.True on a multi-core host: the holder runs on a different core, so a spinner makes progress possible and the O(1) section costs less than a mutex round-trip. FALSE on a priority-preemptive scheduler, where a spinner that outranks the holder never yields the CPU the holder needs to release the lock — the wait becomes unbounded priority inversion and the board hangs in the watchdog rather than merely running slowly. That is true of a single-core chip and equally of an SMP chip whose spinner and holder share a core.
Asserted against the pool’s sync policy (
mem_pool.hpp) and against every LKV slot policy’smay_spin(vertex.hpp, #1618).
-
static constexpr bool kBusLinks = false¶
Whether this target carries the ADR-0044 BUS facet at all — peer-named links, per-peer addressing, in-band peer enumeration (#375 deliverable 3).
A
tr::netfact, and a member HERE for the reason kSpinWaitSafe and kDeviceBackendSlots are: ADR-0070’s rule is that the configuration is ONE named type, so a knob that lives outside it cannot be reached by an override fragment. tr::net::kBusLinks is its spelling for the transport plane.What it closes. A bus link reaches MANY peers and names each of them, so the routing plane carries a second addressing tier for it: the registry stamps a mount’s bus SHAPE and resolves a residual segment as a peer (
child_registry_t::resolve_peer,by_name’s peer fallback),fwd_router_t::add_childwires the peer-named receiver and both peer-lifecycle notifiers, and a connection vertex synthesizes its:children[]from the link’s live peer table. Boundfalse, every one of those consumers folds to the point-to-point answer at COMPILE time throughtr::net::bus_of(transport.hpp), and the peer-named machinery behind them is never reached — ADR-0047 §1 link-time module selection, expressed as a configuration member rather than as a TU list, because whether a tcp/ws listener is peer-named is a WIRING-time choice inside a TU that a bus-less target still compiles for its point-to-point half.What it costs to carry and what the default saves. Measured on rv32 (
-Os -fno-exceptions -fno-rtti,rv32imac_zicsr_zifencei/ilp32, GCC 15.2, per-TU.text), closing it removes 1,400 B of flash fromfwd_router.cppand 678 B fromtransport_vertex.cpp— 2,078 B — and 0 B of.bss, because the tier is code and per-instance state, not a static table. ALIBTRACER_NET_PLANE=OFFbuild gains nothing: it never compiled those TUs in the first place.Default — the lean choice (#1670, v0.17.0). A node whose links are point-to-point — one dial upstream, or a listener that serves its peers as one broadcast link (ADR-0001’s originating firmware shape) — pays nothing for a tier it never uses.
Who opts in. A node that runs a peer-named listener (
peer_named=truetcp/ws), the ESP-IDF WS serverhttpd_ws_link_t, or ANY CAN link — the last two are buses by construction. Override fragment:static constexpr bool kBusLinks = true;— the core test build, thebench/build and the ESP-IDFCONFIG_LIBTRACER_BUS_LINKS(whichCONFIG_LIBTRACER_WS_SERVERselects) do exactly that.It is a REFUSAL, never a silent downgrade. A build that binds it
falseand then asks for a bus is rejected, loudly and at the earliest door that can speak: compilingLIBTRACER_TRANSPORT_CAN(a bus by construction) is astatic_assert, and apeer_named=truetcp/ws listener is refused by its SPEC factory and reportstransport_t::ok() == falsewhen constructed directly. Quietly serving such a configuration as FLAT would be worse than either: the listener’s own per-frame tier select would keep delivering peer-named into a sink the router never installed.
-
static constexpr bool kSelfHealLinks = false¶
Whether this target carries the RFC-0014 §4 S5 LINK-LIVENESS ENGINE at all —
self_heal_link_t, its worker thread and its backoff/redial state machine (#1470).A
tr::netfact, and a member HERE for the reason kBusLinks is: ADR-0070’s rule is that the configuration is ONE named type, so a knob that lives outside it cannot be reached by an override fragment. tr::net::kSelfHealLinks is its spelling for the transport plane.What it closes. The engine is minted on exactly one path — a
config-kindDIAL whose kind was registered withtransport_kind_traits_t::self_heal_dial(transport_vertex.cpp,create_connection_locked). Boundfalse, that mint is discarded at COMPILE time, nothing referencesself_heal_link_t, and the TU is dropped from the archive by the build lists that also gate it (LIBTRACER_SELF_HEAL_LINKSincore/CMakeLists.txt,CONFIG_LIBTRACER_SELF_HEAL_LINKSin the ESP-IDF component).What it costs to carry and what the default saves. Measured by the reporter on an ESP32-C6 image (riscv32,
-Os -fno-exceptions -fno-rtti, same sdkconfig) across the release that made the TU unconditional:nmon the linked ELF finds 4,336 B of reachableself_heal_link_tsymbols (worker_main,attempt_locked,reap_locked, …) out of a +6,224 B image bump, and 0 B of.dram0.bss— the engine is code and per-instance state, not a static table.Default — the lean choice (#1670, v0.17.0; re-rules #1548’s default). The built-in
udp/tcp/wsDIAL kinds then dial EAGERLY, exactly as they did before #1548 made them engine-managed: the connection comes up at creation, with no redial, no backoff and no liveness publishing beyondUP.Who opts in. A node that wants its config-created DIAL connections minted
DORMANTand self-healing, or that registers its ownself_heal_dialkind. Override fragment:static constexpr bool kSelfHealLinks = true;— AND compile the TU (-DLIBTRACER_SELF_HEAL_LINKS=ON; the ESP-IDFCONFIG_LIBTRACER_SELF_HEAL_LINKSdoes both from one symbol). The core test build and thebench/build opt in.It is a REFUSAL, never a silent downgrade. A build that binds it
falseand then registers aself_heal_dialkind is rejected atregister_transport_type: the kind is NOT catalogued, so aSPECnaming it answersSCHEMA_NOT_FOUND— the same answer any unregistered kind gets — and a debug build asserts at the registration itself. Quietly registering it with the trait CLEARED would be worse than either: the connection would come up eagerly, with no redial and no liveness publishing, and nothing would say so.The built-ins are not subject to that refusal, and are not downgraded by it (maintainer ruling 2026-08-25, #1548): they read this knob at their OWN registration site (
kBuiltinPointToPointTraitsinbuiltin_transports.hpp) and declareself_heal_dial = falseon a closed-out build, keeping the eager dial they always had. The refusal above targets a kind that CLAIMS an engine the image does not carry; a build-conditioned declaration claims nothing it cannot have. Making the refusal fire for the built-ins instead would dropudp/tcp/wsout of the catalog and turn the lean default into a broken build.
-
static constexpr std::size_t kSelfHealWorkerStackBytes = 0¶
Stack bytes for the link-liveness engine’s worker thread;
0= the platform default (#1470).The worker is the sole dialer and the sole liveness publisher, so its stack has to carry a
connect()and the publish fan-out beneath it. On a POSIX host the platform default is megabytes of lazily-committed address space and nobody has to think about it. On an RTOS target it is a REAL allocation from the heap, per link: ESP-IDF’sstd::threadis a pthread, and a pthread takesCONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULTfrom a board that may have ~76 KB free — 12,288 B per link on the sdkconfig #1470’s reporter measured. There was no way to size it, which made the engine unusable on such a target INDEPENDENTLY of whether the flash was affordable — the second half of #1470.Applied through
pthread_attr_setstacksizeat the spawn, which is the same mechanismposix_endpoint_t::startandsocketcan_link_t::startalready use for their receive threads, and which IDF’s pthread honours. So it is not an ESP-only knob with an inert body elsewhere: glibc honours it too. A value below the platform floor makespthread_attr_setstacksizereturnEINVALand leaves the default in place — the spawn still happens, with the default stack, exactly as the two precedents behave.Left at
0— every host build, and the default everywhere — nothing is set and the spawn is byte-for-byte the one that shipped. Override fragment:static constexpr std::size_t kSelfHealWorkerStackBytes = 4096;
-
static constexpr bool kListedWaitSources = false¶
Whether every
tr::net::wait_source_tcarries its own link in the lwIP wait adapter’s list (#2147, receiver pays).The lwIP adapter (
wait_poll.cpp,select(2)) keeps no table: each attached source is linked through a pointer in the record its link owns, so a peer is paid by the link it arrived on and the module draws nothing. Theepolladapter needs no such link, so a build that compiles it leaves the pointer out and pays nothing for it.Default , the
epolladapter of a Linux host. A build that compileswait_poll.cppsets ittrue: the ESP-IDF component does so for every chip target, and a non-Linux host build (whose CMake picks the same adapter) does so in its override fragment:static constexpr bool kListedWaitSources = true;. The two adapters each refuse to compile under the other binding, so the TU list and this knob cannot disagree.
-
static constexpr std::size_t kUdpStackScratchBytes = 0¶
The largest
max_framea UDP link receives on its thread’s STACK when its sink borrows (#2142);0= never, the default.A borrowed-span UDP link (no rope receiver) receives each datagram into a stack array of this many bytes plus one, so it holds no receive buffer at rest and pays one
recvfromper datagram with no copy. A link whosemax_frameis above it, and every owning (rope) link, receives into one held segment ofmax_frame + 1bytes from itsmemory.rxinstead.It defaults to
0so that a packaging nobody has audited fails safe: on an RTOS target the stack is a real allocation per receive thread, and a scratch the task’s stack cannot hold is an overflow, not a cost. A POSIX host, where the stack is lazily committed address space, opts in; this tree’s host presets (the test and bench fragments) bindA nonzero value makes a
udp_config_t::recv_stacktoo small to hold the scratch a construction-time refusal (udp_transport_t::kMinRecvStack). Override fragment:static constexpr std::size_t kUdpStackScratchBytes = 16384;
-
static constexpr std::size_t kRxDrainFrames = 32¶
Frames a link’s receive context may consume back to back before it waits for its core to go idle once;
0= no frame budget (ADR-0085).A receive context that always finds more bytes waiting never blocks, so on a core it shares with the idle task a peer that keeps sending keeps that core busy for as long as it likes. On ESP-IDF that is the IDLE task’s watchdog: the board resets. The budget bounds one DRAIN, which is the run of frames a receive context consumes without its core going idle in between. When it is spent, the link stops reading and waits until the core’s idle task has run. The unread bytes stay in the socket, the TCP window closes and the peer’s own stack throttles it (ADR-0081 §2): no frame is dropped, none is buffered by the library, and nothing measures time. The drain counter restarts whenever the core idles on its own, so a link that is not saturated never waits.
Its one reader is the ESP-IDF
httpd_ws_link_t, whose receive context is theesp_http_servertask. Hosted links read the socket from their own thread under a preemptive OS scheduler and do not consult it.Default 32 — sized against the watchdog, not against throughput. The longest stretch the idle task can now be kept out is one budget of frames plus whatever higher-priority work follows it. At the ~7.3 ms of board time per small request measured on an ESP32-C6, 32 frames is about 0.23 s, under a quarter of the shortest task watchdog IDF offers (1 s) and a twentieth of its default (5 s). Each wait costs the time until the core idles, which on a link that is the only load is the time the Wi-Fi and TCP/IP tasks need to settle; per 32 frames that is a small share of the burst. A target whose frames are much dearer than that lowers it.
A non-zero budget requires that the core idles. The wait ends only when the idle task runs, and the idle task runs only once every other task on the core has blocked. So after one budget of back-to-back frames the receive context yields to EVERY lower-priority ready task on its core until all of them block: a priority inversion that bounds the link’s read rate under sustained load by the longest run of lower-priority work. A build whose core may never idle (one that runs a low-priority task that never blocks, and has turned the idle-task watchdog check off for it) must bind
0here and in kRxDrainBytes, or the link stops reading for good after one budget. The ESP-IDF component defaults both to0unless the task watchdog watches the idle task of every core. Override fragment:static constexpr std::size_t kRxDrainFrames = 16;
-
static constexpr std::size_t kRxDrainBytes = 32768¶
Payload bytes a link’s receive context may consume back to back before it waits for its core to go idle once;
0= no byte budget (ADR-0085).The byte half of kRxDrainFrames, with the same reader, the same wait and the same reset. Frames are what a small-write flood costs; bytes are what a large-frame flood costs, where every frame is copied and decoded. A drain ends when EITHER budget is spent. The frame that crosses the line is read whole (a frame is never split), so one drain consumes at most this many bytes plus one frame. The same requirement holds: a non-zero value needs a core that idles (see kRxDrainFrames).
Default 32,768 — the ESP-IDF link’s own per-frame cap, so one maximum-size frame is one drain, and about six default lwIP receive windows. Override fragment:
static constexpr std::size_t kRxDrainBytes = 16384;
-
static constexpr bool kInstrumentCounters = false¶
Whether tr::graph::graph_t carries its two INSTRUMENTATION counters —
ancestor_walks()andtarget_canonical_resolves()(#1664).Both are relaxed 64-bit
fetch_adds on a node-wide counter that nothing in the library reads: no:statsnoun, no wire surface, no decision. Only tests and benches consume them, as ablations proving a write took the leg its name claims — the bubbling walk (RFC-0005) and the target-edge canonical fallback (#830). Paying for them on a shipped node is pure loss, and the loss is not uniform: on rv32 a 64-bit atomic RMW is a libatomic call, taken once per write that has an ancestor subscriber and once per unbound target-edge delivery.Default — the lean choice. Closed out, the two members occupy no bytes of
graph_t([[no_unique_address]]over an empty type), the two increment sites compile to nothing, and the accessors answer0. It also arms the RFC-0022 §6 pin/copy branch counters ofpin_instrument.hpp, which were theLIBTRACER_PIN_INSTRUMENTmacro until #1722. A compile-time member rather than a macro for ADR-0068’s reason: a macro can differ per TU, and these counters changegraph_t’s layout.Who sets it. The core test build and the
bench/build’sLIBTRACER_INSTRUMENT_COUNTERSoption opt in through the checked-in preset fragmentcore/tests/instrumented/libtracer/config_override.hpp. A test that asserts on either counter gates the assertion on this knob, so a CI leg binding its own fragment (which inheritsfalse) still runs the rest of the test. Override fragment:static constexpr bool kInstrumentCounters = true;
-
static constexpr bool kFaultInjection = false¶
Whether the TEST-ONLY fault-injection hooks are compiled in (#1719):
tr::detail::probe_fail_hook,tr::detail::write_fault_inject_hook,tr::net::detail::ws_peer_published_hookandtr::net::detail::tcp_peer_publishing_hook.Each hook is a process-wide function pointer that a test arms to drive a path a healthy host never takes: a nothrow draw the heap refuses, a write errno glibc never returns, a handshake instant held open. Nothing in a shipped node ever arms one, yet each check it guards was a load and a branch on that node — the
probe_fail_hookone on EVERY draw from the process-default block source and every nothrow growth.Default — the lean choice. Closed out, every check is an
if constexprbranch that compiles to nothing: the default allocation path carries no hook load, and no hook variable is odr-used, so none is emitted into the library. The declarations stay visible either way, so a test that arms a hook still compiles under a fragment that leaves thisfalse; arming one there simply changes nothing.Who sets it. The core test build, through its checked-in preset fragment
core/tests/instrumented/libtracer/config_override.hpp, the fragmentcore/CMakeLists.txtwrites for the deprecated-Dknobs when that same test build passes them, and every CI leg that binds a fragment of its own and runs the fault-injection tests. Override fragment:static constexpr bool kFaultInjection = true;
-
static constexpr bool kCreationHooks = false¶
Whether a vertex can carry a CREATION HOOK (RFC-0030 §7.2): app logic on a parent that decides whether a data write to a missing child creates it.
A data write whose walk misses answers
tr::path::not_foundand creates nothing, whatever its origin (RFC-0030 §7.1): the local host API, aFWD{WRITE}terminus, or a branch write’s landing site. The hook is the one way back to “write creates”, and only below a parent whose owner installed one withgraph_t::set_creation_hook.Default on every profile — the lean choice (RFC-0030 §18 Q5). Closed out, no vertex has a hook slot,
graph_t::set_creation_hookanswersSCHEMA_NOT_FOUND, and every miss refuses: the miss arm compiles to thenot_foundanswer and draws nothing.Who sets it. An application that wants opt-in creation, for example an OTA-style flow where a write names the image it brings. The core test build sets it in its preset fragment
core/tests/instrumented/libtracer/config_override.hpp. Override fragment:static constexpr bool kCreationHooks = true;
-
static constexpr std::size_t kPathChainBytes = 40¶
The chain-cache capacity of a path object, in bytes of packed chain body (RFC-0030 §5.4): the elements beyond the first door that a matched reply teaches.
The cache is inline in the object (
tr::graph::path_object_t), so this sets every path object’s size, and a learned chain larger than it is not cached: the canonical form is used instead, with the same answer. Rounded up to whole 4-byte words.0keeps no chain at all, leaving only the local pair (element 0), which a path object always carries.Default 40 bytes: room for three PAIR elements of 11 bytes each (RFC-0029 §4.2), one per node behind the first door, on every profile. Override fragment:
static constexpr std::size_t kPathChainBytes = 64;
-
static constexpr bool kSessionAdmission = false¶
Whether the graph carries the SESSION-ADMISSION seam (#1841):
graph_hooks_t::session_admission, an embedder’s per-session subscribe check and its per-session teardown event.With it, every subscription admitted for a session (a remote subscribe, keyed by the link the departure evicts it by) is first offered to the installed hook, which may refuse it with
BACKPRESSUREbefore the edge or its departure-index entry exists, and the hook is told once when that session’s edges are torn down. That is what an embedder needs to hold each session to its own subscription budget; the library keeps no count of its own.Default on every profile — the lean choice. Closed out, the graph has no slot for the hook, the subscribe and teardown paths carry no load or branch for it, and
graph_hooks_t::session_admissionis an empty type, so installing one (through the constructor orgraph_t::set_hook) does not compile: a budget that silently does not apply is worse than none.Who sets it. An embedder that bounds what one session may subscribe to. The core test build sets it in its preset fragment
core/tests/instrumented/libtracer/config_override.hpp. Override fragment:static constexpr bool kSessionAdmission = true;
-
static constexpr bool kAllowInsecureTls = false¶
Whether a connection SPEC may carry the
insecurekey of thequicandwebtransportkinds — the dial-side switch that skips server-certificate verification.insecureis a DEV-ONLY convenience for reaching a self-signed peer. A SPEC is a wire write, and on a build without an ACL policy any connected peer may write one, so honouring the key unconditionally would let a peer make this node dial with peer authentication switched off. Whether that key is honoured at all is therefore a decision the BUILD states, not the SPEC.Default — the lean and safe choice. Closed out, a SPEC whose config carries
insecure= nonzero is REFUSED at creation: the factory answersgraph::status_t::PERMISSION_DENIEDand counts the refusal (tr::net::quic_insecure_refusals()/tr::net::webtransport_insecure_refusals(), in the respective module header). It is never silently ignored — a dial that asked for no verification and quietly got verification would fail later for a reason nobody wrote down — and never honoured.insecure=0is the explicit “verify” spelling and is accepted either way. An app TLS profile whoseca_filecertifies the peer (selected by the SPEC’stlskey, seetr::net::tls_profile_t) is the way to reach a privately-issued or self-signed peer on a closed-out build.Only the SPEC path is gated. An application that constructs a transport itself with
quic_dial_tls_t{.insecure_no_verify = true}has made that choice in its own C++; no peer can reach that field.Who sets it. A development or test build that dials self-signed peers through a SPEC. The
quicCI workflow runs the QUIC and WebTransport tests a second time under the checked-in fragmentcore/tests/insecure-tls/libtracer/config_override.hpp. Override fragment:static constexpr bool kAllowInsecureTls = true;
-
static constexpr std::size_t kCanLearnedBindings = 8 * 4095¶
The most learned
id ↔ pathbindings one CAN link holds at once (#2203).A receiver keeps a learned binding until a later advertise from the same node overlaps its endpoint run (#909), so one sending node can hold up to its whole data-endpoint window (
net::kCanMaxGroupSlices, 4095 slots) and every node it hears adds its own. This bounds the sum per link. An advertise that would grow the table past it binds nothing and is counted onnet::can_transport_t::dropped_binding_cap(); no binding is ever evicted to make room. A re-issue that retires overlapping bindings first, or rewrites its own slot in place, is never refused by it.Sizing: one binding is about 82 B on a 64-bit host, so the default of eight senders’ whole windows holds at most about 2.7 MB. A narrow target that hears fewer nodes, or whose senders never lap their window, sets it to what it can afford; a counted refusal is the sign it is too small. Override fragment:
static constexpr std::size_t kCanLearnedBindings = 512;
-
static constexpr std::size_t kCanMaxMessageBytes = 65536¶
The longest message one CAN link reassembles, in bytes (#2258).
A receiver admits a multi-frame group when its advertise arrives and draws the group’s whole segment then, so the advertised total is charged before any slice is seen. An advertise claiming more than this is refused, counted on
net::can_transport_t::dropped_groups(), and nothing is drawn. The default covers a 64 KiB CAN-FD message; per link,net::transport_can_config_t::max_messageoverrides it. Override fragment:static constexpr std::size_t kCanMaxMessageBytes = 4096;
-
static constexpr std::size_t kCanRxInflightBytes = 2 * (kCanMaxMessageBytes + 1024)¶
The most reassembly segment bytes one CAN link holds across all its open groups (#2258).
Each admitted group is charged its segment (the message plus one presence bit per slice) until it is delivered or dropped. An advertise whose segment would push the link past this is refused and counted on
net::can_transport_t::dropped_groups(); no open group is evicted to make room. The default holds two maximum-size messages in flight; per link,net::transport_can_config_t::rx_inflight_bytesoverrides it. Override fragment:static constexpr std::size_t kCanRxInflightBytes = 8192;
-
using size_classes_t = size_class_ladder_t<16, 8, 65536, 48>¶
-
using tr::graph::config_t = default_config_t¶
THE configuration this build uses — the one binding, and the one thing to override.
An override fragment binds this alias to its own traits type; with no fragment present it names default_config_t. Everything below is derived from it, so nothing else changes.
-
struct std_sync_t¶
The host’s blocking primitives: the standard library’s, as core always used.
-
using tr::mutex_t = graph::config_t::sync_t::mutex_t¶
This build’s blocking lock (
config_t::sync_t::mutex_t).
This build’s reader/writer lock (
config_t::sync_t::shared_mutex_t).
-
using tr::condvar_t = graph::config_t::sync_t::condvar_t¶
This build’s condition variable, waited on with a
std::unique_lock<tr::mutex_t>.
-
constexpr std::size_t tr::graph::kVertexLockStripes = config_t::kVertexLockStripes¶
default_config_t::kVertexLockStripes for this build.
-
constexpr std::size_t tr::graph::kCacheLineBytes = config_t::kCacheLineBytes¶
default_config_t::kCacheLineBytes for this build.
-
constexpr std::size_t tr::graph::kGuardStripes = config_t::kGuardStripes¶
default_config_t::kGuardStripes for this build.
-
constexpr std::size_t tr::graph::kHazardReaderSlots = config_t::kHazardReaderSlots¶
default_config_t::kHazardReaderSlots for this build.
-
constexpr std::size_t tr::graph::kInlineFanout = config_t::kInlineFanout¶
default_config_t::kInlineFanout for this build.
-
constexpr bool tr::graph::kInstrumentCounters = config_t::kInstrumentCounters¶
default_config_t::kInstrumentCounters for this build.
-
constexpr bool tr::graph::kFaultInjection = config_t::kFaultInjection¶
default_config_t::kFaultInjection for this build.
-
using tr::graph::acl_policy_t = config_t::acl_policy_t¶
default_config_t::acl_policy_t for this build.
-
using tr::graph::lkv_slot_t = config_t::lkv_slot_t¶
default_config_t::lkv_slot_t for this build.
-
using tr::graph::guard_t = detail_guard::sized_guard<config_t>::type¶
The critical-section guard for this build: default_config_t::guard_t, with the inherited host guard sized by
kCacheLineBytesandkGuardStripes(#1716).
-
using tr::graph::reclaim_policy_t = config_t::reclaim_policy_t¶
default_config_t::reclaim_policy_t for this build.
-
constexpr std::size_t tr::graph::kDeferredReleaseSlots = config_t::kDeferredReleaseSlots¶
default_config_t::kDeferredReleaseSlots for this build.
-
constexpr std::size_t tr::graph::kQsbrParticipants = qsbr_participants_v<config_t>¶
default_config_t::kQsbrParticipants for this build; see
qsbr_participants_v.
The derived constants that are not in tr::graph: the memory layer and the transport
plane read their own spellings, so that neither L0 nor tr::net has to name an L4 type.
-
constexpr bool tr::mem::kSpinWaitSafe = tr::graph::config_t::kSpinWaitSafe¶
Whether a task on this target may SPIN-WAIT for a lock another task holds.
The memory layer’s spelling of tr::graph::default_config_t::kSpinWaitSafe, which carries the full rationale. Derived from tr::graph::config_t exactly as the
tr::graphloose names are, so an override fragment sets it in the one place every knob is set.A target fact, so the BUILD states it and nothing asks the integrator (the same reasoning that derives tr::graph::kCacheLineBytes rather than exposing it). Its one consumer is the guard in
synchronized_pool_t, which refuses to instantiate the spinlock policy where spin-waiting is unsafe.
-
constexpr std::size_t tr::mem::kDeviceBackendSlots = tr::graph::config_t::kDeviceBackendSlots¶
How many
DEVICE-space backends may register a transfer hook at once.The memory layer’s spelling of tr::graph::default_config_t::kDeviceBackendSlots, which carries the full rationale. Derived from tr::graph::config_t exactly as kSpinWaitSafe is, so an override fragment sets it in the one place every knob is set. Its one consumer is the bounded table behind register_device_backend (
device_backend.cpp).
-
constexpr bool tr::net::kBusLinks = tr::graph::config_t::kBusLinks¶
Whether this target carries the ADR-0044 BUS facet at all (peer-named links).
The transport plane’s spelling of tr::graph::default_config_t::kBusLinks, which carries the full rationale, the measured saving and the refusal rule. Derived from tr::graph::config_t exactly as tr::mem::kSpinWaitSafe is, so an override fragment sets it in the one place every knob is set. Its consumers reach it through
tr::net::bus_of(transport.hpp) rather than reading it directly.
-
constexpr bool tr::net::kSelfHealLinks = tr::graph::config_t::kSelfHealLinks¶
Whether this target carries the RFC-0014 §4 S5 link-liveness engine at all.
The transport plane’s spelling of tr::graph::default_config_t::kSelfHealLinks, which carries the full rationale, the measured saving and the refusal rule. Derived from tr::graph::config_t exactly as kBusLinks is, so an override fragment sets it in the one place every knob is set.
-
constexpr bool tr::net::kAllowInsecureTls = tr::graph::config_t::kAllowInsecureTls¶
Whether a connection SPEC may carry the dial-side
insecurekey.The transport plane’s spelling of tr::graph::default_config_t::kAllowInsecureTls, which carries the rationale. Derived from tr::graph::config_t exactly as kBusLinks is, so an override fragment sets it in the one place every knob is set. Its consumers are the
quicandwebtransportfactories.
-
constexpr std::size_t tr::net::kSelfHealWorkerStackBytes = tr::graph::config_t::kSelfHealWorkerStackBytes¶
Stack bytes for the link-liveness engine’s worker thread;
0= platform default.The transport plane’s spelling of tr::graph::default_config_t::kSelfHealWorkerStackBytes, which carries the rationale. Its one consumer is the
pthread_attr_setstacksizeat the worker spawn (self_heal_link.cpp).
-
constexpr std::size_t tr::net::kRxDrainFrames = tr::graph::config_t::kRxDrainFrames¶
Frames a receive context consumes back to back before it waits for its core to idle;
0= no frame budget.The transport plane’s spelling of tr::graph::default_config_t::kRxDrainFrames, which carries the rationale. Its one consumer is the ESP-IDF
httpd_ws_link_t.
-
constexpr std::size_t tr::net::kRxDrainBytes = tr::graph::config_t::kRxDrainBytes¶
Payload bytes a receive context consumes back to back before it waits for its core to idle;
0= no byte budget.The transport plane’s spelling of tr::graph::default_config_t::kRxDrainBytes, which carries the rationale. Its one consumer is the ESP-IDF
httpd_ws_link_t.
The selectable policies¶
-
struct allow_only_policy_t¶
The required-modules MCU profile policy (ADR-0020 core subset): ALLOW-only.
Any applicable ACE grants — order is irrelevant because DENY does not exist in this profile (a
:aclwrite carrying one is rejected at parse time).Public Static Functions
-
static inline acl_verdict_t allows(std::span<const std::byte> subject, std::uint32_t bit, std::span<const ace_t> aces, std::uint64_t now, std::uint8_t required_flags = 0) noexcept¶
Evaluate one ACE list — pure: no locks, no clock, no graph access.
- Parameters:
subject – The resolved subject token bytes (ADR-0018).
bit – The requested right (one
acl_right_tbit).aces – One vertex’s stored ACEs, in stored order.
now – The application’s check-time
now(RFC-0037), or kAceNowUnknown when it supplied none.required_flags – ACEs lacking these flag bits are skipped —
0for the target’s own list,kAceInheritfor an ancestor’s.
- Returns:
ALLOWorNO_MATCH(this profile never returnsDENY).
Public Static Attributes
-
static constexpr bool kAcceptsDeny = false¶
This profile rejects DENY ACEs at parse time.
-
static inline acl_verdict_t allows(std::span<const std::byte> subject, std::uint32_t bit, std::span<const ace_t> aces, std::uint64_t now, std::uint8_t required_flags = 0) noexcept¶
-
struct full_acl_policy_t¶
The
security_aclhost policy (ADR-0020 full model): ordered first-match-per-bit with DENY.For the requested bit, the FIRST applicable ACE in stored order decides —
ALLOWorDENYper its type (NFSv4 evaluation). The graph calls this per effective-ACE list, own list before ancestors, so cross-list ordering follows the effective-ACL definition of ADR-0020.Public Static Functions
-
static inline acl_verdict_t allows(std::span<const std::byte> subject, std::uint32_t bit, std::span<const ace_t> aces, std::uint64_t now, std::uint8_t required_flags = 0) noexcept¶
Evaluate one ACE list — pure: no locks, no clock, no graph access.
- Parameters:
subject – The resolved subject token bytes (ADR-0018).
bit – The requested right (one
acl_right_tbit).aces – One vertex’s stored ACEs, in stored order.
now – The application’s check-time
now(RFC-0037), or kAceNowUnknown when it supplied none.required_flags – ACEs lacking these flag bits are skipped —
0for the target’s own list,kAceInheritfor an ancestor’s.
- Returns:
ALLOWorNO_MATCH(this profile never returnsDENY).
Public Static Attributes
-
static constexpr bool kAcceptsDeny = true¶
The full model stores and evaluates DENY ACEs.
-
static inline acl_verdict_t allows(std::span<const std::byte> subject, std::uint32_t bit, std::span<const ace_t> aces, std::uint64_t now, std::uint8_t required_flags = 0) noexcept¶
-
class single_writer_slot_t : public tr::graph::basic_single_writer_slot_t<guard_t>¶
basic_single_writer_slot_t over this build’s
tr::graph::guard_t— the name an override fragment binds.A class rather than an alias so
config.hppcan forward-declare it: the fragment names the slot before this header has been seen, and the guard it will use is a member of the very traits type the fragment is defining.
-
template<::tr::guard G>
class basic_single_writer_slot_t¶ The slot for a single-writer build (RFC 0028 §5.5): one
value_t*, exchanged and retained inside the guardG, which never spins.Why it exists (#1618). The refcount slot this replaced,
std::atomic<std::shared_ptr>, is spin-locked in libstdc++:loadandstoretake a pointer-lock bit and a contender spins on it withsched_yield. On a priority-preemptive single-core scheduler,sched_yieldyields only to equal or higher priority, so a high-priority reader that preempts a low-priority writer inside that window spins until the task watchdog fires. Here the window is a guard that cannot be spun on: an interrupt-masked critical section cannot be preempted at all, and the host’s mutex_guard_t puts a contender to sleep once it has spun out.What the guard covers, and what it does not.
storeswaps the pointer inside the guard and releases the displaced value AFTER leaving it, so a value’s link destructors and its block source never run with interrupts masked.loadretains inside the guard, so the refcount increment cannot interleave with the writer’s release. Both sections are a handful of instructions and call nothing that can block.Writers are serialized too. Nothing here relies on a single publisher: two writers serialize on the guard like a writer and a reader do, so a build that publishes one vertex from two threads is still memory-safe. The name comes from RFC 0028 §5.5, where the single-writer build is the one that must bind it.
Why one publisher would not let the writer skip the guard, even now the slot is one word. It is tempting: one publisher, so nothing to exclude on the write side, publish with a single atomic
exchangeand let readersacquire. The slot IS one word since RFC 0028 slice 3 (an intrusivevalue_t*), so the torn two-word swap theshared_ptrslot had is gone — but the race that matters never needed two words. A reader inside its guard has loaded the pointer and not yet retained it; a writer that exchanges outside the guard goes on toreleasethe displaced value, and if that was the last reference the block is freed under the reader’sretain. The reader’s guard excludes the writer only if the writer’s exchange is inside a guard too: exclusion is pairwise, and the single-writer contract says nothing about readers. So the writer keeps the guard on every target, which is why the per-buildkSingleWriterpromise was removed (#1718): it had nothing left to unlock. (RFC 0028 §5.5’s sentence that a reader’sretaininside its guard “cannot interleave with the writer’s release” once the slot is one word is the claim this paragraph corrects.)lkv_slot_test’s one-writer / N-reader run is the test that bites when this is tried: with the writer’s guard removed, a reader reads a value after its free (ASan: heap-use-after-free).- Template Parameters:
G – A
tr::guard; the slot takesG::for_address(this). The bound slot usesconfig_t::guard_t; tests instantiate this template directly with a guard of their own.
Public Functions
-
inline bool store(value_t *v, std::memory_order = std::memory_order_seq_cst) noexcept¶
Publish. The swap happens inside the guard; the displaced value is released after it, outside.
No fence follows the guard. What
vertex_t::storeneeds from the slot is that the value is visible to an awaiter the publish wakes, and the wake takes the stripe mutex after the guard’s release, so it already carries the swap. The waiterless-publish argument (#555) is about the waiter count only.- Parameters:
v – The value to publish; the slot adopts the caller’s reference. Null clears.
- Returns:
Always
true. A swap allocates nothing, so there is no failure to report.
-
inline void clear(std::memory_order = std::memory_order_seq_cst) noexcept¶
Drop the published value. Releases a reference outside the guard; cannot fail.
-
inline value_ref_t load() const noexcept¶
Read the published value: one guarded
retain.The retain is the refcount increment that lets the handle outlive the guard, and it is the only work inside it.
-
inline ~basic_single_writer_slot_t()¶
Release whatever is still published. No reader can be inside the guard by now.
-
template<std::size_t LineBytes, std::size_t Stripes>
struct basic_mutex_guard_t¶ The host guard: a one-word lock, and a table of them striped by address.
On a single-core RTOS the guard is an interrupt-masked critical section (the ESP-IDF component binds
tr::esp::critical_guard_t), which makes the window unpreemptable. A host process cannot mask interrupts, so this is the host’s spelling of the same promise: a contender that finds the window held gives the CPU back to whoever holds it, instead of spinning until the holder is scheduled again.Public Functions
-
inline void lock() noexcept¶
Take the lock: one RMW, and the out-of-line wait only when it was held.
-
inline void unlock() noexcept¶
Give the lock back: a release store, and nobody to notify (see the class).
Public Static Functions
-
static inline basic_mutex_guard_t &for_address(const void *at) noexcept¶
The stripe the address
athashes to: the top bits of a Fibonacci hash.
Public Static Attributes
-
static constexpr std::size_t kAlign = std::max(LineBytes, alignof(std::atomic<bool>))¶
Each lock’s alignment:
LineBytes, raised to the flag’s natural alignment.
-
static constexpr std::size_t kStripes = Stripes¶
Stripes in the process-wide table for_address draws from.
-
static constexpr unsigned kSpinsBeforeNap = 128¶
Re-reads of a held flag before a contender sleeps; covers a cross-core release.
-
static constexpr std::chrono::microseconds kNap = {20}¶
How long a contender sleeps between looks once it has spun out.
Only a holder descheduled inside its few-instruction window makes anyone sleep, so this bounds the extra latency of that rare case, not the common one. Bounded from below by what one
nanosleepcosts anyway. The one sanctioned sleep in core; see the class for why it is not a futex wait (#2307).
-
static constexpr bool is_isr_safe = false¶
A host thread lock, never an ISR’s.
-
static constexpr bool is_nonblocking = false¶
A contender that spins out SLEEPS — an OS wait (#928).
-
static constexpr bool may_spin = false¶
The wait naps rather than spins, so it is safe on any target (see the class).
-
static constexpr const char *name = "mutex_guard"¶
Census name.
-
inline void lock() noexcept¶
-
typedef basic_mutex_guard_t<64, 64> tr::mutex_guard_t¶
The host guard at its default sizing: 64 stripes, each padded to a 64-byte line.
default_config_t::guard_tnames it; a build that inherits that binding gets the guard re-sized from its ownkCacheLineBytesandkGuardStripes(seeconfig.hpp).
-
struct no_guard_t¶
The guard that guards nothing — for a build that is single-threaded by contract, and the default policy of a pool one thread owns.
A build that binds
hazard_slot_tnever opens a guard, so this is never taken there. A build that bindssingle_writer_slot_t(or a pool) over this guard is asserting that no other thread ever touches the guarded state concurrently — true of a single-threaded program, and of atr::mem::pool_source_twhose one owner is the only thread that draws from it (ADR-0067). It is empty, so[[no_unique_address]]erases it.Public Functions
-
inline void lock() noexcept¶
No section to open.
-
inline void unlock() noexcept¶
No section to close.
Public Static Functions
-
static inline no_guard_t &for_address(const void*) noexcept¶
The one instance every address shares; it holds nothing.
Public Static Attributes
-
static constexpr bool is_isr_safe = false¶
Guards nothing, so promises nothing.
-
static constexpr bool is_nonblocking = true¶
Does nothing, so never waits.
-
static constexpr bool may_spin = false¶
Never waits at all.
-
static constexpr const char *name = "no_guard"¶
Census name.
-
inline void lock() noexcept¶
-
struct reclaim_strict_t¶
**
reclaim_strict** — the grace point is the momentunsubscribe()returns.The opt-in ZERO-COST mode (ADR-0080 §Decision 2) on the subscription-pair reclamation axis (
reclaim_policy_t). Nothing is tracked on the dispatch path, no state is held anywhere, andunsubscribe()runs the release hook inline before it returns — so the caller may free its context on that return with no further ceremony.Target: NARROW bare metal only. Precondition, a hard rule: no preemption and no second core — for example a superloop on a single-core Cortex-M. Any build that preempts, including a single-core RTOS, keeps reclaim_qsbr_t, because preemption alone opens the window in which an unsubscribe retires a pair a suspended fan-out’s snapshot still names, which is a use-after-free. On a unicore build QSBR costs about 22 instructions per publish and no fence, so the opt-out saves little anywhere else.
Re-entrant unsubscribe is FORBIDDEN and NOT DETECTED: unsubscribing from inside a delivery would retire a pair the running fan-out’s snapshot still names. This policy keeps no dispatch state, so no build can see it; that is the trade it exists to make (ADR-0080 Amendment 1 §1).
It is not an alternative to hazard_slot_t, which sits on a different axis (the LKV slot,
lkv_slot_t) and targets WIDE many-core hosts. Neither policy supersedes the other.Selecting it is one line in
libtracer/config_override.hpp:using reclaim_policy_t = reclaim_strict_t;Public Static Attributes
-
static constexpr std::string_view kName = "reclaim_strict"¶
The policy’s name, for a diagnostic that must say which one is bound.
-
static constexpr bool kDefersToDispatchExit = false¶
Whether a retired pair may be DEFERRED past
unsubscribe()’s return.False here: there is no grace period to defer into, so
unsubscribe()releases inline and the dispatch path carries nothing at all.
-
static constexpr std::string_view kName = "reclaim_strict"¶
-
struct reclaim_qsbr_t¶
**
reclaim_qsbr** (the DEFAULT on every target) — the grace point is the moment EVERY dispatching thread has passed a quiescent state (#1376, #2127).The default on WIDE, MID and NARROW alike (ADR-0080 Amendment 1 §1). A grace point stated over one thread cannot be safe: an app thread that unsubscribes at depth 0 would release a pair another thread’s fan-out snapshotted a moment before, and preemption opens that window on one CPU too, so a single-core RTOS build needs it as much as a WIDE host does. reclaim_strict_t is the only opt-out, for bare metal with no preemption and no second core.
What a caller gets¶
A retired
{fn, ctx}pair is released once no thread can still be walking a snapshot that names it. The caller never polls and never waits; it registers a subscriber_release_fn_t and is told. Two cases, and the library picks:No participant is mid-dispatch — every ordinary unsubscribe on a node that is not concurrently publishing. The scan concludes immediately, the hook runs INLINE, and
unsubscribe()returns already quiescent. This is reclaim_strict_t’s guarantee, and it dominates.Some participant IS mid-dispatch. The pair is deferred and released by whichever participant next completes the grace period.
Where the hook runs¶
In case 2 the hook runs on a thread other than the caller — on whichever participant’s quiescence completed the grace period, or on the caller’s own next dispatch exit, whichever comes first. A grace period that spans threads structurally cannot promise the caller’s thread: the only alternatives are to block the caller (ADR-0080 §Decision 4 rejects waiting outright) or to leak the pair. The parity this keeps is the one Amendment 1 defines: the hook runs once, after every snapshot that could name the pair is gone, the same on every target.
So a release hook must be short, thread-safe with respect to its own context, non-blocking and : it may run on a receiving thread, at that thread’s priority and on its stack. Posting the context to an app-owned queue is the ideal shape, and it is also how a context that must be released on its own thread gets there: the hook posts it and that thread frees it. reclaim_strict_t is not the answer to thread affinity; its precondition is no preemption and no second core.
What it costs¶
Per OUTERMOST
fan_out— never per edge, and nothing at all on a publish nobody subscribed to, because the bracket sits belowfan_out’s no-subscriber gate:entry: one RELAXED load of a read-mostly shared line (the epoch, bumped only on the control plane), one release store to this thread’s own cache-line-isolated cell and one
seq_cstfence after it (§qsbr_ordering). No atomic read-modify-write on a shared line;qsbr.hppexit: one
releasestore to that same cell, plus one relaxed load of a read-mostly count that is 0 on any node not mid-teardown, and the predictable branch it guards.
The
O(kQsbrParticipants)scan is on the RECLAIM path only — that is the precise difference from the shape #635 rejected, which put a hazard scan on the READ path. Storage is tr::graph::default_config_t::kQsbrParticipants cache-line-isolated cells plus one shared table of tr::graph::default_config_t::kDeferredReleaseSlots retired pairs, all.bss. The cells and the epoch are also the transport plane’s grace in every build (fwd_router_t’s frame bracket), so a net-plane build carries them under either policy; the retired table is its own object, named only by this policy’s paths, so areclaim_strictbuild does not link it (#2111).What it discharges for #897¶
ADR-0080 §”#897 maps onto the same seam” asks that each thread self-drain its own retired LKV list at its own quiescent point, so
~hazard_slot_tnever has to reach across a live thread’s private list. Under this policy that is exactly what happens, and it costslkv_slot.hppno code at all: the quiescent point calls the already-shippedtr::graph::detail_hp::retire_and_flush(nullptr), whose cheap early-out makes it free on a thread that parked nothing. Nostore()-path atomic is added.Public Static Attributes
-
static constexpr std::string_view kName = "reclaim_qsbr"¶
The policy’s name, for a diagnostic that must say which one is bound.
-
static constexpr bool kDefersToDispatchExit = true¶
Whether a retired pair may be DEFERRED past
unsubscribe()’s return.True: the dispatch bracket’s transition to depth 0 IS the quiescent state this policy announces, and it defers whenever the scan finds a participant that has not yet reached one.
-
struct retired_callback_t¶
One retired subscription’s release obligation — the
{ctx, hook}pair a policy that defers must hold until its grace point.Trivially copyable and free of any owning member, so a bounded array of these is plain storage with no destructor and no initialization guard (which is what lets the QSBR domain’s retired table allocate nothing, ever).
Public Members
-
void *ctx = nullptr¶
The subscriber’s own context.
-
subscriber_release_fn_t release = nullptr¶
What to call on it, exactly once.
-
void *ctx = nullptr¶
-
class hazard_slot_t¶
The host slot (ADR-0069 §1): a lock-free
atomic<node_t*>reclaimed with hazard pointers, returning the same owningvalue_ref_tsingle_writer_slot_t does.Why this exists: today’s slot INVERTS under concurrent readers — measured through the real path,
graph_t::readon one shared LKV falls from 21.1 M/s at one reader to 1.7 M/s at twenty-four, because bothloadandstoretake libstdc++’s_Sp_lockerpointer-lock bit. Hazard reclamation deletes that lock; what it cannot delete is the control-block increment an owning read still owes. End to end that is worth 4.2× at twenty-four readers (7.4 M/s) — see the table in this file’s header, and ADR-0069 §6 for why the model bench’s 20.8× did not survive contact with the whole read path.A WIDE opt-in, for many readers of one hot vertex on a many-core host. The gain over the refcount slot it replaced is a concurrency gain, so a single-core node buys almost nothing from it, publishes slower, and still pays
(kHazardReaderSlots + 1) * 128bytes of registry, a deferred-reclamation lifetime rule (seeretire_and_flush), and a publish that can fail. Such a node binds single_writer_slot_t.Publish can fail under memory exhaustion, which single_writer_slot_t cannot: an empty free list makes the first publish per participant draw a 16-byte node. It is reported, not silent —
storereturnsfalseandvertex_t::storeturns that into the samenullptr→BACKPRESSUREsoft-fail an LKV allocation failure already produces (#477), so no write is ever reported as taken when it was not. Every later publish reuses the node its own displacement recycled, so the window is a warm-up one — but it is still a real difference in the policy’s failure surface, and a third reason the MCU does not bind this slot. Note also that the node comes from the domain’s own node class (#1782): one fixed-size row of 4 KiB slabs the platform heap serves whole, process-wide like the domain, not a graph’s injectedblock_source_t— the slot policy is never handed one, and a bounded target that needs every byte drawn from its own source should bind single_writer_slot_t.It does not spin-wait. The one loop in the domain that waits on another thread is the overflow index’s lock in
detail_hp::ticket_t, and it waits withatomic_flag::wait, which blocks (a futex, or libstdc++’s pooled condition variable) after a bounded spin. The read’s announce-and-revalidate loop retries only when a publish moved the slot, which is progress.Public Functions
-
inline ~hazard_slot_t()¶
Retire the published node rather than free it — a reader may still be pinning it — and flush, so the value cannot outlive the memory it was allocated from.
A slot that was never written costs nothing here: no node, no flush, no domain access.
-
inline bool store(value_t *v, std::memory_order order = std::memory_order_seq_cst) noexcept¶
Publish, sequentially consistent unless the caller says otherwise.
A null value is not a publish — use clear. On success the node adopts the caller’s reference; on
falsethe reference is still the caller’s.- Returns:
falseif no node could be obtained for the value, in which case nothing was published and the previous value still stands. Only a participant’s first publish can reach that: every later one reuses the node its own displacement recycled, so the free list makes the steady state allocation-free.
-
inline void clear(std::memory_order order = std::memory_order_seq_cst) noexcept¶
Drop the published value. Cannot fail — it publishes
nullptr, which needs no node, so a clear allocates nothing even on a cold participant.
-
inline value_ref_t load() const noexcept¶
Read the published value.
Announce, re-read, then
retainthe value out of the pinned node — the retain is the promotion that lets the handle outlive the pin, and it is the one shared-cache-line RMW this scheme cannot remove. A slot nobody has written costs a single acquire load and never touches the domain at all.The announce and the re-read are both
seq_cstso that both sit in one total order with the publisher’sexchangeand the reclaimer’s fence: if a scan did not observe this announcement, then in that order the scan’s read precedes it, the displacement precedes the scan, and so this re-read must observe the displacement and retry.acquireon the re-read is the usual spelling and is believed sound, but it leaves the argument resting on coherence rather than on the total order — and it costs nothing to close, since aseq_cstload is a plainmovon x86-64.Reusing a node is deliberately allowed to ABA: a reader can pin
n, have it reclaimed and republished, and revalidate against the same address. That is not a bug —nis live and holds a value some writer published, which is all a read promises.
Public Static Attributes
-
static constexpr bool may_spin = false¶
No operation spin-waits on another thread; see the class comment.
-
inline ~hazard_slot_t()¶
The runtime settings reader¶
-
class config_reader_t¶
Typed accessors over a positional-pair TLV’s children — a SPEC
configSETTINGS, a SUBSCRIBER QoS SETTINGS, or the creation-SPEC envelope itself.The layout is positional NAME-key / value pairs: a
NAMEchild carrying the key string, immediately followed by the value child — aNAMEfor string values, aVALUEfor integers/flags, or a nestedSETTINGSfor a module namespace. Unknown keys are ignored (forward-compat), a key whose value child has the wrong type (or aVALUEpayload that is not EXACTLY the accessor’s width — a u32 asked of a 2-byte payload is absent, not zero-extended, #928) is ignored too, and when a key appears more than once the LAST well-formed occurrence wins.The walk is pair-consuming: it advances a whole pair at a time, so an unknown key is skipped together with its value and no value child can ever be re-read as a key (#927). Forward-compat tolerance is deliberate here, and is the OPPOSITE ruling from the
graph::parse_aclwalk (#906), which is to REJECT an unknown key: config is where a newer peer legitimately sends more than a receiver understands, whereas an ACL is a security document in which a silently dropped attribute widens access.Note
The returned string_views, spans and nodes (and the reader itself) borrow the frame bytes the node was validated over (tlv_node_t::over) — use them while those bytes are alive. The reader walks the children in place and allocates nothing (#1829).
Public Functions
-
inline explicit config_reader_t(const tlv_node_t *config) noexcept¶
Construct over
config'schildren.- Parameters:
config – The validated pair-container node; nullptr = no config (every accessor returns nullopt). The node is copied (it is two words of borrowed bytes); the bytes it borrows must outlive the reader.
-
inline std::optional<std::string_view> name(std::string_view key) const noexcept¶
The string value of
key(aNAMEvalue child), if present.
-
inline bool has(std::string_view key) const noexcept¶
Whether
keyappears as a key in any well-paired position, whatever its value’s type or width.The presence test for a key a reader must REFUSE rather than skip (a retired key whose silent omission would change behaviour): unlike the typed accessors, a value of the wrong type still counts. Same pair-consuming walk as find(), so a value child spelling
keyis never mistaken for it.
-
inline std::optional<std::span<const std::byte>> name_bytes(std::string_view key) const noexcept¶
The raw payload bytes of
key(aNAMEvalue child), if present.The byte-span twin of name() for a value that is a wire segment rather than text —
graph_t::create_childreads the creation SPEC’s “name” this way, because the child name is appended to the parent’s key verbatim.
-
inline std::optional<tlv_node_t> settings(std::string_view key) const noexcept¶
The nested
SETTINGSvalue child ofkey, or nullopt.A module namespace (“config” in the creation SPEC, a per-transport block in a connection config). A node over the same borrowed bytes, same as every accessor.
-
inline std::optional<std::uint8_t> u8(std::string_view key) const noexcept¶
The u8 value of
key(a 1-byteVALUEchild), if present.
-
inline std::optional<std::uint16_t> u16(std::string_view key) const noexcept¶
The u16 value of
key(a 2-byteVALUEchild), if present.
-
inline std::optional<std::uint32_t> u32(std::string_view key) const noexcept¶
The u32 value of
key(a 4-byteVALUEchild), if present.
-
inline std::optional<bool> flag(std::string_view key) const noexcept¶
The boolean value of
key:a 1-byteVALUEchild read as u8, nonzero = true.
-
inline explicit config_reader_t(const tlv_node_t *config) noexcept¶
See: the configuration space (what each knob costs), security & ACL, graph, fwd-router (which consumes the settings reader).