Skip to content

docs(design): revise 055 wildcard inbound links after review and spike - #266

Merged
lxsaah merged 2 commits into
mainfrom
claude/design-doc-055-review-y7ps2j
Sep 27, 2026
Merged

lxsaah merged 2 commits into
mainfrom
claude/design-doc-055-review-y7ps2j

Conversation

@lxsaah

@lxsaah lxsaah commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Description

Revises design doc 055 (wildcard inbound links) after a review and a throwaway spike that implemented the design. The spike code is not in this PR; this PR changes only docs/design/055-wildcard-inbound-links.md.

New §3 Evaluation. Everything here was measured on the spike:

  • Allocations per message: 0 for exact routes, pattern routes and known keys; 1 for a new key.
  • Routing latency: exact ~80 ns, pattern with key ~140 ns, with 64 other routes.
  • Both MQTT backends run against one broker and subscribe only the covering filter.
  • mountain-mqtt accepts + in SUBSCRIBE.
  • Mosquitto 2.0.18 sends overlapping subscriptions once to an MQTT 3.1.1 client and twice to an MQTT 5 client. So the covering set is required, or the native and embedded backends would deliver different counts.
  • Key-table memory is about 66 bytes per key.

Design changes:

  • The match reaches only with_match_deserializer, as a borrowed TopicMatch<'a>. RuntimeContext and IngestFn are unchanged, and pattern routes don't allocate.
  • TopicGrammar is a trait implemented by connectors, passed as &'static dyn. This is needed for Zenoh's ** in the middle of a pattern and for its hidden @… chunks.
  • A single AimDb::inbound_router is used for both subscribing and routing. Every in-tree connector moves to it.
  • Validation is split: syntax that doesn't depend on the grammar fails build(), and checks that need the grammar fail when the connector builds.
  • MQTT subscribes only the covering set of overlapping filters.
  • There is one key table per record, which grows as keys arrive, and it is reported in RecordMetadata::inbound_keys.
  • A compatibility note: InboundConnectorLink and RecordMetadata gain fields, and both should be marked #[non_exhaustive].
  • Key reuse and an index over pattern routes are listed as non-goals.

Related Issue

  • None

Checklist

  • I have read the CONTRIBUTING.md document.
  • My code follows the project's coding standards. (Documentation only.)
  • I have added tests to cover my changes. (Not applicable: documentation only. The spike's tests are described in §3 and §10.)
  • All new and existing tests passed (make check). (Not run: no code changes.)
  • I have updated the documentation accordingly.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KD5fpkpzuuiEjpGZMAxCxC


Generated by Claude Code

Match reaches user code only via with_match_deserializer as a borrowed
TopicMatch<'a> (no RuntimeContext change, no per-message allocation).
Split validation between build() and connector build; add a single
AimDb::inbound_router used for both subscription and routing; MQTT
subscribes the covering set of overlapping filters; key tables are
owned by the link; key() returns Option<KeyId>; multi-level captures
may be keys; resolver-returned patterns are allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KD5fpkpzuuiEjpGZMAxCxC
Lead with an evaluation of a spike implementation: allocation and latency
measurements, both MQTT backends against one broker, Mosquitto delivering
overlapping subscriptions once to MQTT 3.1.1 and twice to MQTT 5 clients,
and key-table memory.

Design changes from that evaluation: TopicGrammar becomes a trait
(Zenoh's mid-pattern ** needs it); one key table per record, grown
lazily, reported in RecordMetadata::inbound_keys; grammar-dependent
checks move to connector build; all in-tree connectors move to
inbound_router; compatibility caveat for two public structs gaining
fields. Key reuse and a pattern index are non-goals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KD5fpkpzuuiEjpGZMAxCxC
@lxsaah
lxsaah merged commit 9c30603 into main Sep 27, 2026
6 checks passed
@lxsaah
lxsaah deleted the claude/design-doc-055-review-y7ps2j branch September 27, 2026 16:32
@lxsaah lxsaah mentioned this pull request Sep 28, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants