Skip to content

feat(core): AimDbBuilder::connect returns a ConnectorHandle (#390, stage 1) - #397

Merged
lxsaah merged 1 commit into
feature/388-input-output-connectionsfrom
feature/390-connector-handle
Nov 2, 2026
Merged

lxsaah merged 1 commit into
feature/388-input-output-connectionsfrom
feature/390-connector-handle

Conversation

@lxsaah

@lxsaah lxsaah commented Nov 2, 2026

Copy link
Copy Markdown
Member

Description

Stage 1 of 2 for #390, into the #392 feature branch.

  • ConnectorHandle { builder: u32, index: u16 } in aimdb-core::connector, exported at the crate root. It's Copy, Eq and Hash, and holds no string. It's named ConnectorHandle because the crate root already exports the session-layer Connection.
  • AimDbBuilder::connect(&mut self, c) -> ConnectorHandle registers the connector exactly like with_connector, and the index saturates at u16::MAX.
  • Each builder gets an id from a static AtomicU32 starting at 1, so tests can use 0 as a fixed id. Every target in rust-toolchain.toml has this atomic, so no portable-atomic is needed.
  • with_connector's docs point to connect.

Unlike the plan in #390, RecordRegistrar gets its builder_id field in stage 2, together with OutboundLink::on / InboundLink::on and the check that reads it. In this stage nothing would read it.

Tests

  • builder::connect_tests::connect_hands_out_one_handle_per_connector: indices 0 and 1, the same id within one builder, a different id in another builder, and connectors kept in order.
  • typed_api::tests::connected_connector_serves_links: a connector added with connect serves build() and inbound routing like one added with with_connector.

Checks

CI doesn't run on PRs into the feature branch, so I ran these locally:

  • aimdb-core tests with std,tracing,observability (307) and with alloc
  • the thumbv8m build
  • all nine of core's clippy lines from the Makefile (-D warnings), including thumbv7em with defmt
  • cargo doc with -D warnings

Related Issue

🤖 Generated with Claude Code

connect registers a connector exactly like with_connector and returns a
Copy handle holding the builder's id and the connector's index. Each
builder takes a fresh id from a static AtomicU32, so a handle can be
told apart from another builder's; nothing stores or leaks the scheme.

Links through a handle (OutboundLink::on / InboundLink::on) follow in
the next stage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant