Skip to content

79 extensible streamable registry remove closed dispatcher add builder registration#80

Merged
lxsaah merged 10 commits into
mainfrom
79-extensible-streamable-registry-remove-closed-dispatcher-add-builder-registration
Mar 16, 2026
Merged

79 extensible streamable registry remove closed dispatcher add builder registration#80
lxsaah merged 10 commits into
mainfrom
79-extensible-streamable-registry-remove-closed-dispatcher-add-builder-registration

Conversation

@lxsaah

@lxsaah lxsaah commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Open up type registration: Replace the closed for_each_streamable() + StreamableVisitor pattern with .register::<T>() builder methods on WebSocketConnectorBuilder and WasmDb, allowing users to register their own Streamable types
  • Pure traits crate: Remove built-in struct definitions (Temperature, Humidity, GpsLocation) from aimdb-data-contracts and move them to weather-mesh-common example code — the crate is now a pure traits crate at v0.1.0, publishable to crates.io
  • New StreamableRegistry: Add type-erased dispatch registry in aimdb-websocket-connector using monomorphized closures (no Box<dyn Any> on the hot path)
  • WASM adapter made cloneable: SchemaRegistry closures changed from Box to Arc, enabling cheap cloning between WasmDb and WsBridge
  • Publish chain updated: aimdb-data-contracts added as position 5/18 in make publish; all path-only deps now include version constraints for crates.io compatibility
  • Embassy dependency update: Bumped embassy deps to latest versions, arch-cortex-mplatform-cortex-m

Breaking changes

  • for_each_streamable() and StreamableVisitor removed from aimdb-data-contracts
  • contracts module removed from aimdb-data-contracts — import types from your own crate
  • SchemaRegistry::build()SchemaRegistry::new() + .register::<T>() calls
  • Connectors no longer auto-discover types — explicit .register::<T>() required

lxsaah added 6 commits March 13, 2026 14:05
…tion

- Updated aimdb-data-contracts dependency version to 0.1.0 in Cargo.toml.
- Refactored WasmDb to use a new registration method for Streamable types, allowing runtime dispatch.
- Introduced a new StreamableRegistry for managing schema types in the WebSocket connector.
- Added support for registering Streamable types in the WebSocketConnectorBuilder.
- Implemented new data contracts for humidity and GPS location, including simulation and observability features.
- Enhanced temperature schema with versioning and migration support for backward compatibility.
- Added tests for the new StreamableRegistry and its functionalities.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the Streamable type system extensible by replacing the closed visitor-based discovery mechanism with explicit .register::<T>()-style registration across connectors/adapters, while moving demo contract structs out of aimdb-data-contracts to keep it publishable as a traits-only crate.

Changes:

  • Introduces an explicit registration API (.register::<T>()) for WebSocket and WASM adapters and removes the for_each_streamable + StreamableVisitor pattern.
  • Adds a type-erased StreamableRegistry to the WebSocket connector and makes the WASM SchemaRegistry cloneable via Arc-wrapped closures.
  • Updates example crates and dependency versions (including Embassy) and adjusts the publish chain to include aimdb-data-contracts v0.1.0.

Reviewed changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
examples/weather-mesh-demo/weather-station-gamma/Cargo.toml Enables weather-mesh-common simulation features and updates Embassy executor feature flag.
examples/weather-mesh-demo/weather-station-beta/Cargo.toml Enables weather-mesh-common features needed for linking/migration/simulation.
examples/weather-mesh-demo/weather-station-alpha/Cargo.toml Enables weather-mesh-common features needed for linking/migration.
examples/weather-mesh-demo/weather-mesh-common/src/lib.rs Moves demo contract types to local contracts module and re-exports traits.
examples/weather-mesh-demo/weather-mesh-common/src/contracts/temperature.rs Adds demo Temperature contract with migration + simulation + linkability behind features.
examples/weather-mesh-demo/weather-mesh-common/src/contracts/mod.rs Aggregates and re-exports demo contract modules.
examples/weather-mesh-demo/weather-mesh-common/Cargo.toml Adds feature-gated deps for link/sim/migrate in demo contracts crate.
examples/weather-mesh-demo/weather-hub/Cargo.toml Enables weather-mesh-common linking/migration features for hub usage.
examples/embassy-mqtt-connector-demo/Cargo.toml Updates Embassy executor feature flag to new naming.
examples/embassy-knx-connector-demo/Cargo.toml Updates Embassy executor feature flag to new naming.
aimdb-websocket-connector/src/registry.rs Adds new registry for type-erased Streamable dispatch and lookup + tests.
aimdb-websocket-connector/src/lib.rs Exposes the registry module under the server feature.
aimdb-websocket-connector/src/builder.rs Replaces closed discovery with explicit .register::<T>() registration and uses registry for known topics.
aimdb-websocket-connector/Cargo.toml Adds versions to internal deps for crates.io compatibility.
aimdb-wasm-adapter/src/schema_registry.rs Replaces visitor-built registry with explicit registration and makes entries cloneable via Arc.
aimdb-wasm-adapter/src/bindings.rs Switches to SchemaRegistry::new() and adds Rust-only .register::<T>() API on WasmDb.
aimdb-wasm-adapter/Cargo.toml Aligns aimdb-data-contracts version with the new v0.1.0.
aimdb-mqtt-connector/Cargo.toml Bumps Embassy dependency versions (path-based) for embedded support.
aimdb-knx-connector/Cargo.toml Bumps Embassy dependency versions (path-based) for embedded support.
aimdb-data-contracts/src/streamable.rs Removes visitor/discovery API and updates docs/tests to reflect explicit registration model.
aimdb-data-contracts/src/observable.rs Updates docs to avoid importing removed contracts module.
aimdb-data-contracts/src/migratable.rs Updates docs to reference user-defined contract types and new naming.
aimdb-data-contracts/src/linkable.rs Reworks tests to use local test-only structs (no built-in contracts).
aimdb-data-contracts/src/lib.rs Makes crate a traits-focused surface (removes contracts module export) and updates docs.
aimdb-data-contracts/src/contracts/temperature.rs Removes built-in Temperature contract implementation from the traits crate.
aimdb-data-contracts/src/contracts/mod.rs Removes built-in contracts module surface.
aimdb-data-contracts/src/contracts/location.rs Adjusts existing contract code (but contracts module is no longer exported).
aimdb-data-contracts/src/contracts/humidity.rs Adjusts existing contract code (but contracts module is no longer exported).
aimdb-data-contracts/Cargo.toml Sets crate version to v0.1.0, removes ts-rs feature, and adds versions to internal deps.
_external/mountain-mqtt Updates submodule pointer.
_external/knx-pico Updates submodule pointer.
_external/embassy Updates submodule pointer.
Makefile Inserts aimdb-data-contracts into publication order and updates progress counters.
Cargo.toml Updates workspace-pinned Embassy dependency versions and executor feature flag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread aimdb-websocket-connector/src/registry.rs
Comment thread aimdb-websocket-connector/src/registry.rs Outdated
Comment thread aimdb-websocket-connector/src/builder.rs Outdated
@lxsaah lxsaah merged commit 6fbc66c into main Mar 16, 2026
7 checks passed
@lxsaah lxsaah deleted the 79-extensible-streamable-registry-remove-closed-dispatcher-add-builder-registration branch March 16, 2026 21:05
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.

Extensible Streamable Registry — Remove Closed Dispatcher, Add Builder Registration

2 participants