Skip to main content

Module registry_table

Module registry_table 

Source
Expand description

Static dispatch table for well-known [Component] impls.

Maps each well-known ComponentId to its zero-sized ErasedComponent impl so dispatch sites can resolve a runtime ComponentId to the right per-component logic without per-call boxing. The table is hand-maintained and sorted by ComponentId::as_u16() so lookup_component does a single binary search.

§Adding a new well-known component

  1. Add a Component impl in app_data::components::*.
  2. Insert a (ComponentId::FOO, &FooComponent) entry into WELL_KNOWN, maintaining ascending sort order.
  3. The compile-time assert_table_is_sorted_and_unique check at the bottom of this file verifies invariants on every build.

Application-range components have no entry and no process-local handler: every client decodes them with the standard codec for the type in the group’s committed registry, so no local code can change which commits a client accepts.

Statics§

WELL_KNOWN
Sorted-ascending table of (ComponentId, &dyn ErasedComponent) entries for every well-known XMTP component.

Functions§

lookup_component
Look up the well-known ErasedComponent for a ComponentId.