Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: MathiasDanzeisen <67945942+MathiasDanzeisen@users.noreply.github.com>
  • Loading branch information
erikbosch and MathiasDanzeisen authored Dec 5, 2024
1 parent c11e8d4 commit 7106596
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 15 deletions.
4 changes: 2 additions & 2 deletions kuksa-persistence-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ prost-types = "0.11.9"
tokio = { version="1.40.0", features = ["full"] }

# TODO: change this to a a github path once available
djson = { path="../../platform/modules/json-al/djson_rust/" , optional = true }
# djson = { path="../../platform/modules/json-al/djson_rust/" , optional = true } # Uncomment to use djson lib

# For testing
[dev_dependencies]
Expand All @@ -27,5 +27,5 @@ tempfile = "3.2.0"
[features]
default = ["json_tinyjson"]
# use a dependable json library, this still requires tiny-json for writing
json_djson = [ "dep:djson","dep:tinyjson" ]
# json_djson = [ "dep:djson","dep:tinyjson" ] # Uncomment to use djson lib
json_tinyjson = [ "dep:tinyjson" ]
58 changes: 45 additions & 13 deletions kuksa-persistence-provider/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,60 @@ As the statestore does not make a difference between current and target (actuati
## Features

* djson: Use a dependable json library.
Check out the repo with the depenable json library at the same level as the parent folder or project folder of this repo.
Enable with ```cargo build --features json_djson --no-default-features```
* Check out the repo with the depenable json library at the same level as the parent folder or project folder of this repo.
* Edit `Cargo.toml` and uncomment the following lines

```toml
djson = { path="../../platform/modules/json-al/djson_rust/" , optional = true } # Uncommment to use djson

# ...

json_djson = [ "dep:djson","dep:tinyjson" ] # Uncommment to use djson
```
* Install rust nightly which is needed for djson at the moment [11/2024]
```bash
rustup toolchain install nightly
rustup default nightly
```
* Enable with ```cargo build --features json_djson --no-default-features``````


## Build

```bash
cargo build
# with features, see above for prerequisites
cargo build --features json_djson --no-default-features
```

## Test

Start kuksa databroker with:
1) Check for empty data point after startup

* In Terminal A): Start kuksa databroker with:

```bash
docker run -it --rm --net=host ghcr.io/eclipse-kuksa/kuksa-databroker:latest --port 55556
```
```bash
docker run -it --rm --net=host ghcr.io/eclipse-kuksa/kuksa-databroker:latest --port 55556
```

Start kuksa sdk with:
* In Terminal B) Start kuksa sdk with:

```bash
docker run -it --rm --net=host ghcr.io/eclipse-kuksa/kuksa-python-sdk/kuksa-client:latest grpc://127.0.0.1:55556
# Check Vales in cmd
getValue Vehicle.Cabin.HVAC.Station.Row4.Passenger.FanSpeed
```
```bash
docker run -it --rm --net=host ghcr.io/eclipse-kuksa/kuksa-python-sdk/kuksa-client:latest grpc://127.0.0.1:55556
# Check Vales in cmd
getValue Vehicle.Cabin.HVAC.Station.Row4.Passenger.FanSpeed
```

* In Terminal C) Start kuksa persistency provider with:

```bash
cargo run
```

2) Set data point which is stored by persistency provider
* In Terminal B) :

```bash
# Set Vales in cmd
setValue Vehicle.Cabin.HVAC.Station.Row4.Passenger.FanSpeed 40
```
3) Restart and check if datapoint with old value is restored by persistency provider

0 comments on commit 7106596

Please sign in to comment.