Skip to content

Commit 2087bf4

Browse files
Update component request and introduce initial set of requirements.
1 parent 0102500 commit 2087bf4

7 files changed

Lines changed: 556 additions & 690 deletions

File tree

docs/features/baselibs/docs/requirements/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ Requirements
9292

9393
The base libraries shall provide a JSON-Library with parsing functionality.
9494

95+
.. feat_req:: FlatBuffers-Library
96+
:id: feat_req__baselibs__flatbuffers_library
97+
:reqtype: Functional
98+
:security: NO
99+
:safety: ASIL_B
100+
:satisfies: stkh_req__functional_req__base_libraries
101+
:status: valid
102+
103+
The base libraries shall provide a FlatBuffers-Library with serialization, read access, and structural verification of FlatBuffers data.
104+
95105
.. feat_req:: Exception-Free Development Support
96106
:id: feat_req__baselibs__result_library
97107
:reqtype: Functional

docs/modules/baselibs/binary_config_loader/docs/_assets/flatbuffers_dev_mode.drawio.svg

Lines changed: 0 additions & 520 deletions
This file was deleted.

docs/modules/baselibs/binary_config_loader/docs/_assets/flatbuffers_overview.drawio.svg renamed to docs/modules/baselibs/flatbuffers/docs/_assets/flatbuffers_overview.drawio.svg

Lines changed: 121 additions & 118 deletions
Loading
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
..
2+
# *******************************************************************************
3+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
4+
#
5+
# See the NOTICE file(s) distributed with this work for additional
6+
# information regarding copyright ownership.
7+
#
8+
# This program and the accompanying materials are made available under the
9+
# terms of the Apache License Version 2.0 which is available at
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# SPDX-License-Identifier: Apache-2.0
13+
# *******************************************************************************
14+
15+
FlatBuffers Component Architecture
16+
==================================
17+
18+
.. To be created. Link from comp_req to comp is mandatory for score metamodel check.
19+
20+
.. comp:: JSON
21+
:id: comp__baselibs_flatbuffers
22+
:security: YES
23+
:safety: ASIL_B
24+
:status: invalid

docs/modules/baselibs/binary_config_loader/docs/index.rst renamed to docs/modules/baselibs/flatbuffers/docs/index.rst

Lines changed: 87 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,152 +12,187 @@
1212
# SPDX-License-Identifier: Apache-2.0
1313
# *******************************************************************************
1414
15-
binary config loader
16-
====================
15+
FlatBuffers-Library
16+
===================
1717

18-
.. document:: binary config loader
19-
:id: doc__binary_config_loader
20-
:status: draft
18+
.. document:: FlatBuffers-Library
19+
:id: doc__flatbuffers
20+
:status: valid
2121
:safety: ASIL_B
22+
:security: YES
2223
:tags: component_request
24+
:realizes: wp__cmpt_request
25+
26+
27+
.. toctree::
28+
:hidden:
29+
30+
requirements/index.rst
31+
architecture/index.rst
2332

2433

2534
Abstract
26-
--------
35+
========
36+
37+
This component request proposes the integration of Google FlatBuffers [#flatbuffers]_ providing
38+
serialization, zero-copy read access, and structural verification of FlatBuffers data, as well as code
39+
generation via the ``flatc`` compiler.
40+
41+
Additionally, the library introduces FlatBuffers binary configuration format to replace JSON-based
42+
module configuration. FlatBuffers provides zero-copy access, schema validation, and access code
43+
generation for C++, Rust, and further languages. The approach eliminates the need for runtime
44+
parsing and accelerates module startup times. Safety certification covers ``flatc`` tool
45+
qualification, runtime library verification, and module-level testing of generated code.
2746

28-
This feature introduces FlatBuffers [#flatbuffers]_ binary configuration format to replace JSON-based module configuration.
29-
FlatBuffers provides zero-copy access, schema validation, and access code generation for C++, Rust and further languages.
30-
The approach eliminates the need for runtime parsing and accelerates module startup times.
31-
Safety certification covers flatc tool qualification, runtime library verification and module-level testing of generated code.
3247

3348
Motivation
34-
----------
49+
==========
3550

36-
Module specific configuration is a cross-cutting concern that impacts system startup time and development efficiency.
37-
For read-only configuration scenarios, runtime parsing approaches can limit startup performance in time-critical applications.
51+
Module specific configuration is a cross-cutting concern that impacts system startup time and
52+
development efficiency. For read-only configuration scenarios, runtime parsing approaches can
53+
limit startup performance in time-critical applications.
3854

39-
FlatBuffers [#flatbuffers]_ binary configuration approach addresses these engineering challenges by:
55+
The FlatBuffers binary configuration approach addresses these engineering challenges by:
4056
- Eliminating the need for runtime parsing to meet aggressive startup time requirements
4157
- Providing compile-time type safety through generated access code
4258
- Reducing development effort through automated access code generation
4359
- Ensuring schema validation at build time
4460

4561
Given its cross-cutting nature, this architectural decision shall be done early in the project.
4662

63+
4764
Rationale
48-
---------
65+
=========
66+
67+
Real-world experience with complex modules (e.g. diagnostics, SOME/IP) demonstrates that read-only
68+
configuration scenarios benefit significantly from zero-copy access patterns. For these use cases,
69+
FlatBuffers is ideal as it allows zero-copy data access. The schema-driven code generation further
70+
accelerates development by providing type-safe access patterns, reducing both implementation effort
71+
and the potential for configuration-related runtime errors.
72+
4973

50-
Real-world experience with complex modules (e.g. diagnostics, SOME/IP) demonstrates that read-only configuration
51-
scenarios benefit significantly from zero-copy access patterns. For these use cases, FlatBuffers is ideal as it allows
52-
zero-copy data access. The schema-driven code generation further accelerates development by providing
53-
type-safe access patterns, reducing both implementation effort and the potential for configuration-related runtime errors.
74+
Basic Functionality
75+
===================
5476

55-
Specification
56-
-------------
77+
The ``flatc`` compiler shall generate code for serializing, accessing, and verifying
78+
FlatBuffers binary data. Code generation shall be provided for C++ and Rust at ASIL-B level
79+
and other languages as needed at QM level (e.g. Python).
5780

58-
Module configuration shall use FlatBuffers [#flatbuffers]_ binary format for read-only configuration scenarios to achieve
59-
aggressive start-up time requirements.
81+
The FlatBuffers-Library shall provide services for serialization, zero-copy access of
82+
FlatBuffers binary data, and structural verification of buffers. The library shall also support
83+
loading FlatBuffers binary files and optionally provide common buffer identification and version
84+
checking mechanisms.
85+
86+
Note: FlatBuffers verification mechanism validates structural well-formedness only (e.g. offsets, vtables,
87+
field boundaries), not payload data integrity.
88+
89+
Module configuration shall use FlatBuffers binary format for read-only configuration scenarios to
90+
achieve aggressive start-up time requirements.
6091

6192
.. _flatbuffers_overview:
6293

6394
Implementation
64-
^^^^^^^^^^^^^^
95+
--------------
6596

6697
.. figure:: _assets/flatbuffers_overview.drawio.svg
6798
:alt: FlatBuffers overview
6899
:align: center
69100
:width: 80%
70101

71102
| FlatBuffers schema files (``config.fbs``) define configuration structure using Interface Definition Language (IDL).
72-
| The flatc compiler generates C++ or Rust access code from these schemas (``config.fbs``).
73-
| The flatc compiler generates cross-platform data binary from schema (``config.fbs``) and JSON (``config.json``) input.
103+
| The ``flatc`` compiler generates C++ or Rust access code from these schemas (``config.fbs``).
104+
| The ``flatc`` compiler generates cross-platform data binary from schema (``config.fbs``) and JSON (``config.json``) input.
74105
| Runtime access operates directly on binary config data (``config.bin``) without parsing (lazy loading).
75-
| The flatc compiler can convert binary config data (``config.bin``) back to JSON using the schema (``config.fbs``) for debugging purposes.
106+
| The ``flatc`` compiler can convert binary config data (``config.bin``) back to JSON using the schema (``config.fbs``) for debugging purposes.
76107
77108
Schema Evolution
78-
""""""""""""""""
109+
^^^^^^^^^^^^^^^^
79110

80111
Backward compatibility through:
81112
- Optional fields for new parameters
82113
- Default values for missing fields
83114
- Controlled field deprecation
84115

85116
Schema Versioning
86-
"""""""""""""""""
117+
^^^^^^^^^^^^^^^^^
87118

88119
FlatBuffers binary files do not contain embedded schema information. Schema identification requires:
89120
- Embedded version fields in the schema root table
90121
- File naming conventions (e.g., config_v1.2.bin)
91122

92123
Build Integration
93-
^^^^^^^^^^^^^^^^^
124+
-----------------
94125

95126
Build system integration shall provide reusable rules for:
96127
- Binary configuration file generation from module specific schema and user-provided JSON data
97128
- Reverse conversion from binary to JSON for debugging purposes
98129

99-
Base libs
100-
^^^^^^^^^
130+
Binary Config Loading
131+
---------------------
101132

102-
Binary config loader provides unified interface supporting:
103-
- Binary data file loading (production, see :ref:`FlatBuffers overview <flatbuffers_overview>`)
104-
- Runtime binary data creation from schema and JSON, allowing on-target JSON manipulation (development mode, QM)
133+
The FlatBuffers-Library provides a unified interface for binary data file loading
134+
(see :ref:`FlatBuffers overview <flatbuffers_overview>`).
105135

106-
Mode selection between development and production can be transparent to calling modules.
107-
108-
.. image:: _assets/flatbuffers_dev_mode.drawio.svg
109-
:alt: FlatBuffers development mode (QM)
110-
:align: center
111-
:width: 80%
112136

113137
Backwards Compatibility
114-
-----------------------
138+
=======================
115139

116140
Switching from JSON to FlatBuffers for module configuration is not backwards compatible.
117141

142+
118143
Security Impact
119-
---------------
144+
===============
120145

121146
No change expected when compared to JSON based configuration approach.
122147

148+
123149
Safety Impact
124-
-------------
150+
=============
125151

126-
**Tool Qualification**: flatc compiler qualification shall be limited to binary creation use case.
152+
**Tool Qualification**: ``flatc`` compiler qualification shall be limited to buffer serialization use case.
127153
Brief qualification is supplemented by module-specific validation.
128154

129155
**Verification Runtime Library**: Footprint when excluding verifier/builder classes
130156
- C++: 12 headers, ~250 LOC (incl. comments), standard library only
131157
- Rust: 11 files, ~150 LOC (incl. comments), core/alloc only (assumes std/serialize features disabled)
132158

133159
**Verification Generated Code**: Module-level verification is equivalent to handwritten access code verification.
134-
Module testing contributes to flatc tool validation for specific schemas.
160+
Module testing contributes to ``flatc`` tool validation for specific schemas.
135161
Test from configuration data (JSON) to value verification in access APIs.
136162

163+
137164
License Impact
138-
--------------
165+
==============
139166

140167
None. FlatBuffers is licensed under the Apache License Version 2.0.
141168

169+
142170
How to Teach This
143-
-----------------
171+
=================
144172

145173
Developer adoption requires practical examples and reusable patterns.
146-
The module template or baselibs should provide examples for reference implementations.
174+
The FlatBuffers-Library should provide examples for reference implementations.
175+
147176

148177
Rejected Ideas
149-
--------------
178+
==============
150179

151180
**Protocol Buffers**: Requires runtime parsing and memory allocation, defeating startup time objectives.
152181

153182
**Custom binary formats**: Higher development and maintenance overhead compared to proven FlatBuffers ecosystem.
154183

184+
155185
Open Issues
156-
-----------
186+
===========
157187

158188
No open issues identified yet.
159189

190+
191+
Future Extensions
192+
=================
193+
194+
160195
Footnotes
161-
---------
196+
=========
162197

163198
.. [#flatbuffers] https://google.github.io/flatbuffers/

0 commit comments

Comments
 (0)