Summary
Integrate Embassy (no_std) and Tokio (std) runtimes into aimdb-core, enabling AimDB services to run asynchronously across MCU, Edge and Cloud targets.
This milestone lays the foundation for the long-term library-mode AimDB runtime (init_*, run) with a builder-based database specification.
Goal
Create a runtime-agnostic abstraction layer that:
- Provides portable APIs for spawning asynchronous tasks.
- Introduces the
#[aimdb_core::service] macro for long-running async services.
- Implements runtime adapters for both Tokio and Embassy.
- Ensures the same service code compiles and runs on all supported platforms.
Scope
1. Runtime Abstraction (aimdb-core)
Define a traits for launching asynchronous tasks and provide two concrete adapters:
- A Tokio adapter using the standard Tokio spawn mechanism (aimdb-tokio-adapter)
- An Embassy adapter using the Embassy spawner (aimdb-embassy-adapter)
Expose a lightweight runtime handle or executor struct that AimDB components can use internally for spawning.
2. Service Macro (#[aimdb_core::service])
Introduce a procedural macro to declare long-running async services.
- On Embassy, it should expand to an Embassy task attribute and implement a portable spawn method.
- On Tokio, it should generate a small shim that spawns the service dynamically.
Each service implements an internal trait that allows AimDB to start it in a runtime-neutral way.
3. Runtime Integration into AimDB
Extend aimdb-core to manage the active runtime internally and provide initialization and run functions for both runtimes.
The initial integration will focus on manual service spawning while keeping compatibility with the long-term builder-based design.
Deliverables
- Runtime abstraction module in
aimdb-core.
- Tokio runtime adapter using the standard Tokio executor in
aimdb-tokio-adapter.
- Embassy runtime adapter integrating with
embassy_executor::Spawner in aimdb-embassy-adapter.
- Procedural macro
#[aimdb_core::service] implemented in aimdb-macros.
Acceptance Criteria
- Services defined with
#[service] compile and run successfully on both Embassy and Tokio.
- No explicit Tokio or Embassy imports are required in user service code.
- Minimal examples build and execute successfully for both runtimes using feature flags.
- The design remains compatible with the planned library-mode AimDB API (
init_*, run, and builder-based specification).
Summary
Integrate Embassy (no_std) and Tokio (std) runtimes into
aimdb-core, enabling AimDB services to run asynchronously across MCU, Edge and Cloud targets.This milestone lays the foundation for the long-term library-mode AimDB runtime (
init_*,run) with a builder-based database specification.Goal
Create a runtime-agnostic abstraction layer that:
#[aimdb_core::service]macro for long-running async services.Scope
1. Runtime Abstraction (aimdb-core)
Define a traits for launching asynchronous tasks and provide two concrete adapters:
Expose a lightweight runtime handle or executor struct that AimDB components can use internally for spawning.
2. Service Macro (
#[aimdb_core::service])Introduce a procedural macro to declare long-running async services.
Each service implements an internal trait that allows AimDB to start it in a runtime-neutral way.
3. Runtime Integration into AimDB
Extend
aimdb-coreto manage the active runtime internally and provide initialization and run functions for both runtimes.The initial integration will focus on manual service spawning while keeping compatibility with the long-term builder-based design.
Deliverables
aimdb-core.aimdb-tokio-adapter.embassy_executor::Spawnerinaimdb-embassy-adapter.#[aimdb_core::service]implemented inaimdb-macros.Acceptance Criteria
#[service]compile and run successfully on both Embassy and Tokio.init_*,run, and builder-based specification).