Skip to main content

Module registry

Module registry 

Expand description

The index registry — the single source for resolving an index code.

Resolution unions a fixed set of built-in static tables with a process-scoped overlay of indices registered at runtime via register. Custom registrations win over the built-ins; the overlay is never persisted.

Statics§

INDEX_REGISTRY
Every kind’s table, unioned. Lookup and enumeration scan these in order.

Functions§

builtins 🔒
The built-in tables hashed by upper-cased code, built once on first use. Insertion order follows the table scan order, first entry winning a duplicate code — identical resolution to the linear scan it replaces.
builtins_by_name 🔒
The built-in tables hashed by upper-cased display name, built once on first use — the name lives on the constructed index, not on the table row, so this pays one construction per entry once per process rather than one per entry on every lookup (a miss used to construct the whole registry). Insertion order follows the table scan order, first entry winning a duplicate name — identical resolution to the linear scan it replaces.
codes
Every registered index as (kind, name, code).
is_builtin 🔒
Whether code names a built-in (statically registered) index.
kind_name 🔒
An index’s display name, whatever kind it is.
lookup
Resolves an index code (case-insensitive) to its definition. Custom (process-scoped) registrations take precedence over the built-in tables.
lookup_by_name
Resolves an index by its display name (case-insensitive) — e.g. "SOFR" where lookup wants the code "USD-SOFR". Custom (process-scoped) registrations take precedence over the built-in tables; within each source the first name match wins. Built for resolution keyed by free-form strings (projection-curve keys) that may carry either a code or a name.
overlay 🔒
Process-scoped overlay of custom indices, keyed by upper-cased code. Empty unless register is called; consulted by lookup before the built-ins.
register
Registers a custom index under code for the remainder of the process, resolvable by lookup wherever a built-in is. Returns an error if code already names a built-in index, or a previously registered custom index, unless replace is set. Registrations are process-scoped and never persisted.