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
codenames 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"wherelookupwants 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
registeris called; consulted bylookupbefore the built-ins. - register
- Registers a custom index under
codefor the remainder of the process, resolvable bylookupwherever a built-in is. Returns an error ifcodealready names a built-in index, or a previously registered custom index, unlessreplaceis set. Registrations are process-scoped and never persisted.