-
Notifications
You must be signed in to change notification settings - Fork 21
testing DDD #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
testing DDD #27
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,3 +60,4 @@ __pycache__/ | |
| devenv.local.nix | ||
| .direnv | ||
| target | ||
| docs/crates | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,144 @@ | ||||||
| Detailed Design for Component: rust_kvs | ||||||
| ======================================= | ||||||
|
|
||||||
| Description | ||||||
| ----------- | ||||||
|
|
||||||
| This document showcases the integration between Rust code and Sphinx documentation using the `sphinxcontrib-rust` extension. | ||||||
| The `rust_kvs` crate provides a key-value storage solution in Rust with JSON-like persistence and is documented directly from Rust source code. | ||||||
| This approach **ensures traceability** and minimizes manual documentation drift. | ||||||
|
|
||||||
| | **Design Decisions** | ||||||
| | - Leverage code-level documentation for API docs (minimize manual work). | ||||||
| | - Public Rust API is always reflected in documentation. | ||||||
| | - Full traceability from requirements to code and API. | ||||||
|
|
||||||
| | **Design Constraints** | ||||||
| | - Only public API is documented (as per current extension configuration). | ||||||
| | - The extension requires a buildable and parseable Rust crate structure. | ||||||
|
|
||||||
| Rationale Behind Decomposition into Units | ||||||
| ***************************************** | ||||||
|
|
||||||
| The decomposition into units is guided by: | ||||||
| - **SOLID** principles for maintainability and separation of concerns. | ||||||
| - **API boundary clarity**: structs, enums, and traits each define a logical design unit. | ||||||
| - Rust module boundaries. | ||||||
|
|
||||||
| Static Diagrams for Unit Interactions | ||||||
| ------------------------------------- | ||||||
|
|
||||||
| .. dd_sta:: Key Rust API Structure | ||||||
| :id: dd_sta__ddd__api | ||||||
| :security: YES | ||||||
| :safety: ASIL_B | ||||||
| :status: valid | ||||||
| :implements: comp_req__rust_kvs | ||||||
| :satisfies: comp_arc_sta__rust_kvs | ||||||
|
|
||||||
| .. uml:: | ||||||
| :caption: Example module structure | ||||||
|
|
||||||
| @startuml | ||||||
| package "rust_kvs" { | ||||||
| class Kvs | ||||||
| class KvsApi <<trait>> | ||||||
| class KvsBuilder | ||||||
| class KvsValue | ||||||
| class ErrorCode | ||||||
| } | ||||||
| Kvs -|> KvsApi | ||||||
| KvsBuilder --> Kvs | ||||||
| @enduml | ||||||
|
|
||||||
| Dynamic Diagrams for Unit Interactions | ||||||
| -------------------------------------- | ||||||
|
|
||||||
| .. dd_dyn:: Typical Usage | ||||||
| :id: dd_dyn__ddd__usage | ||||||
| :security: NO | ||||||
| :safety: QM | ||||||
| :status: valid | ||||||
| :implements: comp_req__rust_kvs | ||||||
| :satisfies: comp_arc_sta__rust_kvs | ||||||
|
|
||||||
| .. uml:: | ||||||
| :caption: Typical Use Flow | ||||||
|
|
||||||
| @startuml | ||||||
| actor User | ||||||
| User -> KvsBuilder: new() | ||||||
| KvsBuilder -> KvsBuilder: need_defaults()/need_kvs() | ||||||
| KvsBuilder -> KvsBuilder: build() | ||||||
| KvsBuilder --> Kvs: returns Kvs instance | ||||||
| User -> Kvs: set_value()/get_value() | ||||||
| User -> Kvs: flush() | ||||||
| @enduml | ||||||
|
|
||||||
| Units within the Component | ||||||
| -------------------------- | ||||||
|
|
||||||
| .. sw_unit:: Kvs | ||||||
| :id: sw_unit__ddd__kvs | ||||||
| :security: YES | ||||||
| :safety: ASIL_B | ||||||
| :status: valid | ||||||
|
|
||||||
| .. rust:struct:: rust_kvs::Kvs | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the discussion, we had the Idea to Indentation the following statement as part of this need element. So we do have a link from the Detailed need element to the autogenerated content.
Suggested change
Do we want to proceed with the Idea? |
||||||
| :index: 1 | ||||||
| :vis: pub | ||||||
|
|
||||||
| Key-value-storage data (see API below, auto-generated) | ||||||
|
|
||||||
| .. sw_unit:: KvsApi | ||||||
| :id: sw_unit__ddd__kvsapi | ||||||
| :security: YES | ||||||
| :safety: ASIL_B | ||||||
| :status: valid | ||||||
|
|
||||||
| .. rust:trait:: rust_kvs::KvsApi | ||||||
| :index: 1 | ||||||
| :vis: pub | ||||||
|
|
||||||
| The public API for interacting with the KVS (auto-generated). | ||||||
|
|
||||||
| .. sw_unit:: ErrorCode | ||||||
| :id: sw_unit__ddd__errorcode | ||||||
| :security: YES | ||||||
| :safety: ASIL_B | ||||||
| :status: valid | ||||||
|
|
||||||
| .. rust:enum:: rust_kvs::ErrorCode | ||||||
| :index: 1 | ||||||
| :vis: pub | ||||||
|
|
||||||
| Error codes for runtime failures (auto-generated). | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is written Code auto generated or will the ErrorCode later been auto generated? |
||||||
|
|
||||||
| Interface | ||||||
| ********* | ||||||
|
|
||||||
| .. sw_unit_int:: Kvs Public Interface | ||||||
| :id: sw_unit_int__ddd__kvs_public | ||||||
| :security: YES | ||||||
| :safety: ASIL_B | ||||||
| :status: valid | ||||||
|
|
||||||
| Auto-generated API reference (see below): | ||||||
|
|
||||||
| .. toctree:: | ||||||
| :maxdepth: 2 | ||||||
|
|
||||||
| crates/rust_kvs/lib | ||||||
|
|
||||||
| Key Features Demonstrated | ||||||
| ------------------------- | ||||||
|
|
||||||
| - **Automatic extraction of all structs, enums, traits, and their documentation.** | ||||||
| - **API documentation always in sync with the Rust codebase.** | ||||||
| - **Cross-links between Rust types, trait implementations, and function signatures.** | ||||||
| - **Integration of code-level docs with Sphinx diagrams and requirements traceability.** | ||||||
| - **Supports documenting multiple crates in a single project.** | ||||||
|
|
||||||
| .. note:: | ||||||
| All Rust API documentation is auto-generated from code using the `sphinxcontrib-rust` extension and `sphinx-rustdocgen`. | ||||||
| To update docs, simply update code comments and re-build the documentation. | ||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use needarch / needuml instead of uml directive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.