Skip to content

Commit f1dae03

Browse files
lxsaahCopilot
andauthored
8 runtime adapter integration #1 (#25)
* Add Tokio runtime and time-related adapter implementations - Introduced `TokioAdapter` for async task spawning and execution. - Implemented time-related capabilities including timestamps and sleep. - Updated feature flags in `Cargo.toml` for tracing and optional dependencies. * Add Embassy runtime and time integration for AimDB * Add runtime adapter traits and time utilities for async operations * fix linter warnings * add service macro * Enhance runtime adapters and database implementation * Add Embassy dependencies for async support in the project * Add Embassy database implementation and runtime adapter enhancements * Refactor service macro implementation for improved runtime support and clarity * Add Tokio database implementation and runtime integration * fix doctest * Update dependencies and enhance runtime adapter functionality for AimDB * Enhance Embassy database and runtime adapter with service spawning capabilities * Refactor service macro implementation for improved runtime spawning and clarity * Refactor TokioAdapter to implement SpawnDynamically and enhance runtime service spawning capabilities * Reorganize module imports for improved clarity and consistency * Add RuntimeContext for unified access to runtime capabilities and update service macro for automatic context injection * Add aimdb-executor to workspace and update Tokio dependency features * Refactor Makefile to update build and test commands for aimdb-core, replacing 'embedded' with 'no_std minimal' and adjusting feature validation tests for clarity. * Refactor build scripts to remove 'embedded' feature validation and clarify no_std requirements for aimdb-core and aimdb-embassy-adapter * Refactor aimdb-core and aimdb-executor to enhance runtime integration and error handling, including new executor traits and improved feature definitions. * Refactor service macro to improve runtime spawning methods and error handling, updating AimDbService implementation for better integration with Tokio and Embassy runtimes. * Refactor Embassy adapter to enhance compatibility with executor traits, updating service spawning methods and error handling for improved runtime integration. * Refactor Tokio adapter to improve integration with aimdb-executor, updating dependencies and error handling for better compatibility with async tasks. * Refactor CI and documentation workflows to improve embedded target checks and documentation generation, updating Makefile and contributing guidelines for better clarity and functionality. * Refactor RuntimeContext to use aimdb_executor::Runtime, enhancing runtime capabilities and compatibility across std and no_std environments. * Refactor EmbassyDatabase and EmbassyAdapter to improve service spawning methods and unify runtime trait implementations, enhancing compatibility with async tasks in embedded environments. * Refactor TokioAdapter to unify Runtime trait implementations, adding TimeSource and Sleeper traits for enhanced async task management and compatibility. * Add TimeSource and Sleeper traits for unified runtime capabilities in AimDB * Refactor service macro implementation for clarity and runtime-agnostic design, enhancing service definition and spawning mechanisms. * Enhance TimeSource trait by adding Debug trait bound to Instant type for improved debugging capabilities. * Refactor service macro documentation and improve generics handling for enhanced clarity and flexibility in runtime implementations. * Add global static adapter initialization and unique task wrapper naming for Embassy services * Add example project for AimDB integration with Embassy runtime * Add example project demonstrating AimDB integration with Tokio runtime * Add shared service implementations for AimDB examples * Refactor AimDB examples structure and update dependencies * Fix missing newline at end of file in Embassy runtime demo build script * Enhance Embassy task spawning documentation in service macro * Remove example builds from CI workflow and add documentation generation step * Remove unsupported licenses from deny.toml * Fix formatting of 0BSD license entry in deny.toml * Add logging capabilities to runtime context and services * Add logging support using defmt in Embassy adapter * Implement logging capabilities for TokioAdapter with info, debug, warn, and error methods * Refactor RuntimeContext to separate time and logging utilities for improved organization and clarity * Enhance TimeSource trait in Embassy and Tokio adapters with duration methods for improved time handling * Enhance TimeSource trait with runtime-agnostic duration methods for improved time handling * Refactor data_processor_service and monitoring_service to use stored log and time accessors for improved code clarity and efficiency * Add flash script for embassy-runtime-demo to facilitate binary flashing * Add submodule for embassy-rs * fix embassy runtime example * Refactor AimDB Executor and Macros for Simplified Runtime Integration * Refactor AimDB database and adapter implementations for unified builder API and improved service spawning * Add examples command to Makefile for building example projects * Implement Emitter pattern for cross-record communication Enhance core library structure and exports Introduce metrics tracking for producer-consumer patterns Implement producer-consumer pattern with self-registering records Add tracked async function wrapper for automatic call tracking Develop type-safe record storage using TypeId * Refactor Embassy database and example to simplify record handling and improve builder API * Enhance Tokio adapter features and documentation for improved usability * Add producer-consumer demo example with unified Database API * Add producer-consumer demo example and update workspace configuration * Add submodule support to CI workflows for improved dependency management * Update Cargo.toml for producer-consumer-demo to use workspace settings for version, edition, and license * Update aimdb-core/src/error.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update aimdb-core/src/database.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add examples target to all command in Makefile for comprehensive build Remove global static adapter initialization and related methods for cleaner API --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 5d445b0 commit f1dae03

56 files changed

Lines changed: 6321 additions & 261 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
1921

2022
- name: Install Rust
2123
uses: dtolnay/rust-toolchain@stable
@@ -43,6 +45,8 @@ jobs:
4345
runs-on: ubuntu-latest
4446
steps:
4547
- uses: actions/checkout@v4
48+
with:
49+
submodules: recursive
4650

4751
- name: Install Rust
4852
uses: dtolnay/rust-toolchain@stable
@@ -73,6 +77,8 @@ jobs:
7377
runs-on: ubuntu-latest
7478
steps:
7579
- uses: actions/checkout@v4
80+
with:
81+
submodules: recursive
7682

7783
- name: Install Rust
7884
uses: dtolnay/rust-toolchain@stable
@@ -95,6 +101,8 @@ jobs:
95101
runs-on: ubuntu-latest
96102
steps:
97103
- uses: actions/checkout@v4
104+
with:
105+
submodules: recursive
98106

99107
- name: Install Rust
100108
uses: dtolnay/rust-toolchain@stable
@@ -110,8 +118,11 @@ jobs:
110118
target
111119
key: ${{ runner.os }}-cargo-embedded-${{ hashFiles('**/Cargo.lock') }}
112120

113-
- name: Check embedded core
114-
run: cargo check --package aimdb-core --target thumbv7em-none-eabihf --features embedded
121+
- name: Check embedded core (no_std minimal)
122+
run: cargo check --package aimdb-core --target thumbv7em-none-eabihf --no-default-features
123+
124+
- name: Check embedded core (with embassy)
125+
run: cargo check --package aimdb-core --target thumbv7em-none-eabihf --no-default-features --features embassy-runtime
115126

116127
- name: Check embassy adapter
117128
run: cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --features embassy-runtime
@@ -130,6 +141,8 @@ jobs:
130141

131142
steps:
132143
- uses: actions/checkout@v4
144+
with:
145+
submodules: recursive
133146

134147
- name: Install Rust
135148
uses: dtolnay/rust-toolchain@stable
@@ -173,6 +186,8 @@ jobs:
173186
needs: [format-and-lint, makefile-build, feature-validation, embedded-targets, adapters]
174187
steps:
175188
- uses: actions/checkout@v4
189+
with:
190+
submodules: recursive
176191

177192
- name: Install Rust
178193
uses: dtolnay/rust-toolchain@stable
@@ -192,8 +207,5 @@ jobs:
192207
- name: Run comprehensive development check
193208
run: make check
194209

195-
- name: Build examples
196-
run: cargo build --package aimdb-examples
197-
198210
- name: Generate documentation
199211
run: make doc

.github/workflows/devcontainer.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ jobs:
7979
steps:
8080
- name: Checkout repository
8181
uses: actions/checkout@v4
82+
with:
83+
submodules: recursive
8284

8385
- name: Set up Docker Buildx
8486
uses: docker/setup-buildx-action@v3
@@ -163,6 +165,8 @@ jobs:
163165
steps:
164166
- name: Checkout repository
165167
uses: actions/checkout@v4
168+
with:
169+
submodules: recursive
166170

167171
- name: Set up Docker Buildx
168172
uses: docker/setup-buildx-action@v3

.github/workflows/docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
environment: ${{ github.ref == 'refs/heads/main' && 'github-pages' || null }}
1919
steps:
2020
- uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
2123

2224
- name: Install Rust
2325
uses: dtolnay/rust-toolchain@stable
@@ -41,7 +43,7 @@ jobs:
4143
cp -r target/doc/* target/doc-final/cloud/
4244
4345
# Build embedded documentation
44-
cargo doc --features "embedded,embassy-runtime" --no-deps
46+
cargo doc --no-default-features --features "embassy-runtime" --no-deps
4547
cp -r target/doc/* target/doc-final/embedded/
4648
4749
# Copy main index page

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
1719

1820
- name: Install Rust
1921
uses: dtolnay/rust-toolchain@stable

.github/workflows/security.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v4
26+
with:
27+
submodules: recursive
2628

2729
- name: Install Rust
2830
uses: dtolnay/rust-toolchain@stable
@@ -38,6 +40,8 @@ jobs:
3840
runs-on: ubuntu-latest
3941
steps:
4042
- uses: actions/checkout@v4
43+
with:
44+
submodules: recursive
4145

4246
- name: Install Rust
4347
uses: dtolnay/rust-toolchain@stable

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "_external/embassy"]
2+
path = _external/embassy
3+
url = https://github.com/embassy-rs/embassy.git

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ embedded = ["no-std-compat"]
144144
# All tests with all features
145145
make test
146146

147-
# Embedded target tests
148-
cargo test --features embedded --target thumbv7em-none-eabihf
147+
# Embedded target cross-compilation check
148+
make test-embedded
149149

150150
# Specific test
151-
cargo test test_name --all-features
151+
cargo test test_name --features tokio-runtime
152152
```
153153

154154
### Test Requirements

0 commit comments

Comments
 (0)