Skip to content

Commit 5604aa9

Browse files
authored
Merge pull request #101 from eclipse-kuksa/feature/databroker-api-v2
Feature/databroker api v2
2 parents 0af2e2e + 041729b commit 5604aa9

Some content is hidden

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

54 files changed

+8737
-451
lines changed

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The [COVESA Vehicle Signal Specification](https://covesa.github.io/vehicle_signa
6060

6161
However, VSS does not define how these signals are to be collected and managed within a vehicle, nor does it prescribe how other components in the vehicle can read or write signal values from and to the tree.
6262

63-
**Kuksa Databroker** is a resource efficient implementation of the VSS signal tree and is intended to be run within a vehicle on a microprocessor based platform. It allows applications in the vehicle to interact with the vehicle's sensors and actuators using a uniform, high level gRPC API for querying signals, updating current and target values of sensors and actuators and getting notified about changes to signals of interest.
63+
**Kuksa Databroker** is a resource efficient implementation of the VSS signal tree and is intended to be run within a vehicle on a microprocessor based platform. It allows applications in the vehicle to interact with the vehicle's sensors and actuators using a uniform, high level gRPC API for querying signals, updating values of sensors and actuators and getting notified about changes to signals of interest.
6464

6565
<!-- black box diagram -- inputs/outputs -->
6666

@@ -88,6 +88,21 @@ Data is usually exchanged with ECUs by means of a CAN bus or Ethernet based prot
8888

8989
<p align="right">(<a href="#readme-top">back to top</a>)</p>
9090

91+
<!-- KUKSA ANALYSIS -->
92+
## Kuksa analysis
93+
Extended [Kuksa analysis](./doc/kuksa_analysis.md) containing functional requirements, use cases diagrams, latest and new API definition `kuksa.val.v2` as well as new design discussions for future developments and improvements.
94+
95+
### APIs supported by Databroker
96+
97+
Kuksa Databroker implements the following service interfaces:
98+
99+
- Enabled on Databroker by default [kuksa.val.v2.VAL](proto/kuksa/val/v2/val.proto) (recommended to use)
100+
- Enabled on Databroker by default [kuksa.val.v1.VAL](proto/kuksa/val/v1/val.proto)
101+
- Disabled on Databroker by default [sdv.databroker.v1.Broker](proto/sdv/databroker/v1/broker.proto)
102+
- Disabled on Databroker by default [sdv.databroker.v1.Collector](proto/sdv/databroker/v1/collector.proto)
103+
104+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
105+
91106
<!-- GETTING STARTED -->
92107

93108
## Getting started
@@ -120,7 +135,8 @@ The quickest possible way to get Kuksa Databroker up and running.
120135
### Reading and writing VSS data using the CLI
121136

122137
1. Start the CLI in a container attached to the _kuksa_ bridge network and connect to the Databroker container:
123-
The databroker supports both of `sdv.databroker.v1` and `kuksa.val.v1` as an API. Per default the databroker-cli uses the `sdv.databroker.v1` interface. To change it use `--protocol` option when starting. Choose either one of `kuksa-val-v1` and `sdv-databroker-v1`.
138+
139+
The databroker supports the lastest new API `kuksa.val.v2` and `kuksa.val.v1` by default, `sdv.databroker.v1` must be enabled using `--enable-databroker-v1`. Per default the databroker-cli uses the `kuksa.val.v1` interface, which can be changed by supplying the `--protocol` option when starting. Choose either `kuksa.val.v1` or `sdv.databroker.v1`, as databroker-cli still does not support `kuksa.val.v2`.
124140

125141
```sh
126142
# in a new terminal
@@ -252,6 +268,15 @@ cargo test --all-targets
252268

253269
<p align="right">(<a href="#readme-top">back to top</a>)</p>
254270

271+
## Performance
272+
The Kuksa team has released an official tool to measure the latency and throughput of the Databroker for all supported APIs:
273+
[kuksa-perf](https://github.com/eclipse-kuksa/kuksa-perf)
274+
275+
The use case measures the time it takes for a signal to be transferred from the Provider to the Signal Consumer
276+
Signal Consumer(stream subscribe) <- Databroker <- Provider(stream publish)
277+
278+
Feel free to use it and share your results with us!
279+
255280
## Contributing
256281

257282
Please refer to the [Kuksa Contributing Guide](CONTRIBUTING.md).

data/vss-core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use the full name. When official release is created replace the copied *.json-fi
6060
Build and run kuksa_databroker using the new VSS file according to [documentation](../../README.md), e.g.
6161

6262
```sh
63-
$cargo run --bin databroker -- --metadata ../data/vss-core/vss_release_4.0.json
63+
$cargo run --bin databroker -- --metadata ./data/vss-core/vss_release_4.0.json
6464
```
6565

6666
Use the client to verify that changes in VSS are reflected, by doing e.g. set/get on some new or renamed signals.

databroker-cli/src/sdv_cli.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,8 @@ mod test {
12631263
change_type: proto::v1::ChangeType::OnChange.into(),
12641264
description: "".into(),
12651265
allowed: None,
1266+
min: None,
1267+
max: None,
12661268
},
12671269
proto::v1::Metadata {
12681270
id: 2,
@@ -1272,6 +1274,8 @@ mod test {
12721274
change_type: proto::v1::ChangeType::OnChange.into(),
12731275
description: "".into(),
12741276
allowed: None,
1277+
min: None,
1278+
max: None,
12751279
},
12761280
proto::v1::Metadata {
12771281
id: 3,
@@ -1281,6 +1285,8 @@ mod test {
12811285
change_type: proto::v1::ChangeType::OnChange.into(),
12821286
description: "".into(),
12831287
allowed: None,
1288+
min: None,
1289+
max: None,
12841290
},
12851291
]
12861292
.to_vec();

databroker-proto/build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* SPDX-License-Identifier: Apache-2.0
1212
********************************************************************************/
1313

14+
use std::{env, path::PathBuf};
15+
1416
fn main() -> Result<(), Box<dyn std::error::Error>> {
1517
std::env::set_var("PROTOC", protobuf_src::protoc());
1618
tonic_build::configure()
@@ -23,8 +25,23 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2325
"proto/sdv/databroker/v1/collector.proto",
2426
"proto/kuksa/val/v1/val.proto",
2527
"proto/kuksa/val/v1/types.proto",
28+
"proto/kuksa/val/v2/val.proto",
29+
"proto/kuksa/val/v2/types.proto",
2630
],
2731
&["proto"],
2832
)?;
33+
34+
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
35+
tonic_build::configure()
36+
.file_descriptor_set_path(out_dir.join("kuksa.val.v2_descriptor.bin"))
37+
.compile(
38+
&[
39+
"proto/kuksa/val/v2/val.proto",
40+
"proto/kuksa/val/v2/types.proto",
41+
],
42+
&["proto"],
43+
)
44+
.unwrap();
45+
2946
Ok(())
3047
}

databroker-proto/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,11 @@ pub mod kuksa {
143143
}
144144
}
145145
}
146+
pub mod v2 {
147+
tonic::include_proto!("kuksa.val.v2");
148+
149+
pub const FILE_DESCRIPTOR_SET: &[u8] =
150+
tonic::include_file_descriptor_set!("kuksa.val.v2_descriptor");
151+
}
146152
}
147153
}

databroker/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ kuksa-common = { path = "../lib/common"}
2727
kuksa = { path = "../lib/kuksa"}
2828
databroker-proto = { workspace = true }
2929
tonic = { workspace = true, features = ["transport", "channel", "prost"] }
30+
tonic-reflection = "0.11.0"
3031
prost = { workspace = true }
3132
prost-types = { workspace = true }
3233
tokio = { workspace = true, features = [
@@ -60,9 +61,11 @@ jemallocator = { version = "0.5.0", optional = true }
6061
lazy_static = "1.4.0"
6162
thiserror = "1.0.47"
6263

64+
futures = { version = "0.3.28" }
65+
async-trait = "0.1.82"
66+
6367
# VISS
6468
axum = { version = "0.6.20", optional = true, features = ["ws"] }
65-
futures = { version = "0.3.28", optional = true }
6669
chrono = { version = "0.4.31", optional = true, features = ["std"] }
6770
uuid = { version = "1.4.1", optional = true, features = ["v4"] }
6871

@@ -74,7 +77,7 @@ sd-notify = "0.4.1"
7477
default = ["tls"]
7578
tls = ["tonic/tls"]
7679
jemalloc = ["dep:jemallocator"]
77-
viss = ["dep:axum", "dep:chrono", "dep:futures", "dep:uuid"]
80+
viss = ["dep:axum", "dep:chrono", "dep:uuid"]
7881
libtest = []
7982

8083
[build-dependencies]

0 commit comments

Comments
 (0)