From be51ac7ba8002c37910ab2c862507c31b3055f1f Mon Sep 17 00:00:00 2001 From: Lauren Datz <105828115+ladatz@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:00:01 -0500 Subject: [PATCH] Fix more references --- .cargo/config | 2 +- .github/workflows/containerize.yaml | 2 +- .github/workflows/e2e-ci.yml | 22 +++---- .github/workflows/lt-ci.yml | 32 +++++----- Dockerfile.intent_brokering | 15 +++-- Dockerfile.intent_brokering.arm64 | 16 ++--- Dockerfile.intent_brokering.valgrind | 20 +++--- build-all-containers.sh | 6 +- docs/memory-profiling.md | 18 +++--- intent_brokering/README.md | 36 +++++------ intent_brokering/common/src/streaming_ess.rs | 2 +- .../examples/applications/Dockerfile.base | 2 +- .../Dockerfile.cloud-object-detection | 2 +- .../examples/applications/Dockerfile.generic | 2 +- .../applications/Dockerfile.kv-app.ci | 10 +-- .../Dockerfile.lt-provider-app.ci | 17 ++--- .../examples/applications/Dockerfile.mock-vas | 2 +- .../applications/Dockerfile.simulated-camera | 2 +- .../src/intent_provider.rs | 2 +- .../cloud-object-detection/src/main.rs | 6 +- .../dog-mode-logic/src/dog_mode_status.rs | 30 ++++----- .../applications/dog-mode-logic/src/main.rs | 64 +++++++++---------- .../applications/dog-mode-ui/src/Program.cs | 2 +- .../applications/invoke-command/src/main.rs | 6 +- .../applications/invoke_object_detection.sh | 2 +- .../examples/applications/kv-app/README.md | 2 +- .../kv-app/src/intent_provider.rs | 6 +- .../examples/applications/kv-app/src/main.rs | 6 +- .../src/intent_provider.rs | 2 +- .../local-object-detection/src/main.rs | 6 +- .../applications/lt-consumer/src/main.rs | 16 ++--- .../applications/lt-provider/src/main.rs | 8 +-- .../mock-vas/src/intent_provider.rs | 12 ++-- .../applications/mock-vas/src/main.rs | 6 +- .../applications/mock-vas/src/simulation.rs | 2 +- .../applications/simple-provider/src/main.rs | 34 +++++----- .../applications/simulated-camera/README.md | 2 +- .../simulated-camera/src/camera.rs | 2 +- .../simulated-camera/src/intent_provider.rs | 6 +- .../applications/simulated-camera/src/main.rs | 6 +- .../examples/common/src/examples/detection.rs | 2 +- .../examples/common/src/examples/mod.rs | 2 +- .../src/{chariott => intent_brokering}/api.rs | 42 ++++++------ .../inspection.rs | 0 .../src/{chariott => intent_brokering}/mod.rs | 0 .../provider.rs | 2 +- .../registration.rs | 36 +++++------ .../streaming.rs | 2 +- .../{chariott => intent_brokering}/value.rs | 0 intent_brokering/examples/common/src/lib.rs | 2 +- .../intent_brokering/common/v1/common.proto | 6 +- intent_brokering/src/execution.rs | 4 +- ...riott_grpc.rs => intent_brokering_grpc.rs} | 0 intent_brokering/src/lib.rs | 2 +- intent_brokering/src/main.rs | 6 +- intent_brokering/tests/README.md | 2 +- .../tests/chariott_integration.rs | 8 +-- .../tests/container-e2e-tests-wsl2.sh | 10 +-- intent_brokering/tests/provider.rs | 2 +- intent_brokering/tests/registry-e2e.rs | 16 ++--- intent_brokering/tests/store-e2e.rs | 40 ++++++------ intent_brokering/tools/charc | 8 +-- 62 files changed, 316 insertions(+), 312 deletions(-) rename intent_brokering/examples/common/src/{chariott => intent_brokering}/api.rs (90%) rename intent_brokering/examples/common/src/{chariott => intent_brokering}/inspection.rs (100%) rename intent_brokering/examples/common/src/{chariott => intent_brokering}/mod.rs (100%) rename intent_brokering/examples/common/src/{chariott => intent_brokering}/provider.rs (97%) rename intent_brokering/examples/common/src/{chariott => intent_brokering}/registration.rs (81%) rename intent_brokering/examples/common/src/{chariott => intent_brokering}/streaming.rs (96%) rename intent_brokering/examples/common/src/{chariott => intent_brokering}/value.rs (100%) rename intent_brokering/src/{chariott_grpc.rs => intent_brokering_grpc.rs} (100%) diff --git a/.cargo/config b/.cargo/config index 1d6d3f82..34416d5a 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,5 +1,5 @@ [env] -DEFAULT_CHARIOTT_URL = "http://0.0.0.0:4243" +DEFAULT_INTENT_BROKER_URL = "http://0.0.0.0:4243" [target.'cfg(all())'] rustflags = ["-D", "warnings"] diff --git a/.github/workflows/containerize.yaml b/.github/workflows/containerize.yaml index 1a3bbb35..b195c703 100644 --- a/.github/workflows/containerize.yaml +++ b/.github/workflows/containerize.yaml @@ -1,6 +1,6 @@ name: Containerize and Push to Container Registry -# Containerizes and pushes a build of the Chariott to a container registry. +# Containerizes and pushes a build of Chariott Intent Brokering to a container registry. # # To use this in your own clone of this repo, you need to configure three Github Action secrets: # 1. CONTAINER_REGISTRY_ENDPOINT: The DNS endpoint of your container registry (eg. sdv.azurecr.io) diff --git a/.github/workflows/e2e-ci.yml b/.github/workflows/e2e-ci.yml index 92144811..7f42e609 100644 --- a/.github/workflows/e2e-ci.yml +++ b/.github/workflows/e2e-ci.yml @@ -46,13 +46,13 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Build Chariott Container + - name: Build Intent Brokering service Container uses: docker/build-push-action@v3 with: context: . file: ./Dockerfile.intent_brokering load: true - tags: chariott:1 + tags: intent_brokering:1 - name: Build KV-App Container uses: docker/build-push-action@v3 @@ -63,12 +63,12 @@ jobs: load: true tags: kv-app:1 - - name: Start Chariott + - name: Start Intent Brokering run: | - docker run -d --name chariott --network host \ + docker run -d --name intent_brokering --network host \ -e RUST_LOG=debug \ -e CHARIOTT_REGISTRY_TTL_SECS \ - chariott:1 + intent_brokering:1 - name: Start KV-App run: | @@ -78,17 +78,17 @@ jobs: run: | cargo test --test "*e2e" - - name: Print Chariott log output + - name: Print Intent Brokering log output if: ${{ always() }} run: | - docker logs chariott > chariott.log - docker logs chariott + docker logs intent_brokering > intent_brokering.log + docker logs intent_brokering - - name: Archive Chariott log output + - name: Archive Intent Brokering log output uses: actions/upload-artifact@v1 with: - name: Chariott E2E log - path: chariott.log + name: Intent Brokering E2E log + path: intent_brokering.log - name: Print KV App log output if: ${{ always() }} diff --git a/.github/workflows/lt-ci.yml b/.github/workflows/lt-ci.yml index 80b92560..2f17f722 100644 --- a/.github/workflows/lt-ci.yml +++ b/.github/workflows/lt-ci.yml @@ -53,21 +53,21 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Build chariott container + - name: Build intent brokering container uses: docker/build-push-action@v3 with: context: . file: Dockerfile.intent_brokering load: true - tags: chariott:1 + tags: intent_brokering:1 - - name: Build valgrind enabled chariott container + - name: Build valgrind enabled intent brokering container uses: docker/build-push-action@v3 with: context: . file: ./Dockerfile.intent_brokering.valgrind load: true - tags: val-chariott:1 + tags: intent_brokering.valgrind:1 - name: Build lt-provider-app container uses: docker/build-push-action@v3 @@ -78,9 +78,9 @@ jobs: load: true tags: lt-provider-app:1 - - name: Start chariott and lt-provider-app + - name: Start intent_brokering and lt-provider-app run: | - docker run --init --detach --name chariott --network host chariott:1 + docker run --init --detach --name intent_brokering --network host intent_brokering:1 docker run --init --detach --name lt-provider-app --network host lt-provider-app:1 - name: Run load tests @@ -92,9 +92,9 @@ jobs: - name: Stop containers run: | docker kill --signal=SIGINT lt-provider-app - docker kill --signal=SIGINT chariott + docker kill --signal=SIGINT intent_brokering docker stop lt-provider-app - docker stop chariott + docker stop intent_brokering - name: Print performance numbers run: | @@ -107,21 +107,21 @@ jobs: - name: Print log output if: ${{ always() }} run: | - docker logs chariott + docker logs intent_brokering docker logs lt-provider-app for f in lt-output/*.log; do echo -e "Printing output of file $f:\n" cat "$f"; done - - name: Start chariott and lt-provider-app + - name: Start intent_brokering and lt-provider-app run: | docker rm lt-provider-app - docker rm chariott + docker rm intent_brokering mkdir -p valgrind-output sudo chown -R 10001:10001 valgrind-output sudo chmod -R 777 valgrind-output - docker run --init --detach --name val-chariott --network host --volume $(pwd)/valgrind-output:/output val-chariott:1 + docker run --init --detach --name intent_brokering.valgrind --network host --volume $(pwd)/valgrind-output:/output intent_brokering.valgrind:1 docker run --init --detach --name lt-provider-app --network host lt-provider-app:1 - name: Run Memory Profiling using load tests @@ -134,9 +134,9 @@ jobs: - name: Stop containers run: | docker kill --signal=SIGINT lt-provider-app - docker kill --signal=SIGINT val-chariott + docker kill --signal=SIGINT intent_brokering.valgrind docker stop lt-provider-app - docker stop val-chariott + docker stop intent_brokering.valgrind - name: Create valgrind benchmark report run: | @@ -167,7 +167,7 @@ jobs: uses: benchmark-action/github-action-benchmark@v1 if: ${{ github.event_name != 'workflow_dispatch' }} with: - name: Chariott Benchmark + name: Intent Brokering Benchmark tool: 'customSmallerIsBetter' output-file-path: lt-output/all.json github-token: ${{ secrets.GITHUB_TOKEN }} @@ -181,7 +181,7 @@ jobs: - name: Print log output if: ${{ always() }} run: | - docker logs val-chariott + docker logs intent_brokering.valgrind docker logs lt-provider-app for f in lt-output/*.log; do echo -e "Printing output of file $f:\n" diff --git a/Dockerfile.intent_brokering b/Dockerfile.intent_brokering index f46e0bd3..aca76e46 100644 --- a/Dockerfile.intent_brokering +++ b/Dockerfile.intent_brokering @@ -5,10 +5,11 @@ ARG RUST_VERSION=1.70 FROM docker.io/library/rust:${RUST_VERSION} AS builder -# Dockerfile for building Eclipse Chariott runtime container +# Dockerfile for building Eclipse Chariott Intent Brokering runtime container # -# This Dockerfile utilizes a two step build process. It builds Chariott with -# statically linked dependencies (using musl) for a x86_64 architecture. +# This Dockerfile utilizes a two step build process. It builds Intent Brokering +# service with statically linked dependencies (using musl) for a x86_64 +# architecture. # Chariott user id ARG CHARIOTT_UID=10001 @@ -16,7 +17,7 @@ ARG CHARIOTT_UID=10001 RUN apt update && apt upgrade -y RUN apt install -y cmake protobuf-compiler -# unprivileged identity to run Chariott as +# unprivileged identity to run Chariott Intent Brokering service as RUN adduser \ --disabled-password \ --gecos "" \ @@ -32,7 +33,7 @@ COPY ./ . RUN rustup target add x86_64-unknown-linux-musl -RUN cargo build --release --target=x86_64-unknown-linux-musl -p chariott +RUN cargo build --release --target=x86_64-unknown-linux-musl -p intent-brokering #################################################################################################### ## Final image @@ -46,9 +47,9 @@ COPY --from=builder /etc/group /etc/group WORKDIR /sdv # Copy our build -COPY --from=builder /sdv/target/x86_64-unknown-linux-musl/release/chariott /sdv/chariott +COPY --from=builder /sdv/target/x86_64-unknown-linux-musl/release/intent_brokering /sdv/intent_brokering # Use the unprivileged chariott user during execution. USER chariott:chariott -CMD ["./chariott"] +CMD ["./intent_brokering"] diff --git a/Dockerfile.intent_brokering.arm64 b/Dockerfile.intent_brokering.arm64 index a5158f48..6c5288e0 100644 --- a/Dockerfile.intent_brokering.arm64 +++ b/Dockerfile.intent_brokering.arm64 @@ -5,12 +5,12 @@ ARG RUST_VERSION=1.70 FROM docker.io/library/rust:${RUST_VERSION} AS builder -# Dockerfile for building Eclipse Chariott container for ARM64 with -# cross-compilation. +# Dockerfile for building Eclipse Chariott Intent Brokering service container +# for ARM64 with cross-compilation. # # This Dockerfile utilizes a two step build process. It builds the with -# statically linked dependencies (using musl vs. glibc to accomplish this) for a -# specific architecture such that we can utilize a scratch container without +# statically linked dependencies (using musl vs. glibc to accomplish this) for +# a specific architecture such that we can utilize a scratch container without # further dependencies for our final container, minimizing container size. # Chariott user id @@ -19,7 +19,7 @@ ARG CHARIOTT_UID=10001 RUN apt update && apt upgrade -y RUN apt install -y cmake protobuf-compiler gcc-aarch64-linux-gnu -# unprivileged identity to run Chariott as +# unprivileged identity to run Chariott Intent Brokering service as RUN adduser \ --disabled-password \ --gecos "" \ @@ -35,7 +35,7 @@ COPY ./ . RUN rustup target add aarch64-unknown-linux-musl -RUN cargo build --release --target=aarch64-unknown-linux-musl -p chariott +RUN cargo build --release --target=aarch64-unknown-linux-musl -p intent-brokering #############################################################x####################################### ## Final image @@ -49,9 +49,9 @@ COPY --from=builder /etc/group /etc/group WORKDIR /sdv # Copy our build -COPY --from=builder /sdv/target/aarch64-unknown-linux-musl/release/chariott /sdv/chariott +COPY --from=builder /sdv/target/aarch64-unknown-linux-musl/release/intent_brokering /sdv/intent_brokering # Use the unprivileged Chariott user during execution. USER chariott::chariott -CMD ["./chariott"] +CMD ["./intent_brokering"] diff --git a/Dockerfile.intent_brokering.valgrind b/Dockerfile.intent_brokering.valgrind index f19dbe72..69644cb8 100644 --- a/Dockerfile.intent_brokering.valgrind +++ b/Dockerfile.intent_brokering.valgrind @@ -5,12 +5,14 @@ ARG RUST_VERSION=1.70 FROM docker.io/library/rust:${RUST_VERSION} AS builder -# Dockerfile for building Eclipse Chariott container +# Dockerfile for building Eclipse Chariott Intent Brokering service container +# with valgrind # -# This Dockerfile utilizes a two step build process. It builds Chariott with -# statically linked dependencies (using musl vs. glibc to accomplish this) for a -# specific architecture such that we can utilize a scratch container without -# further dependencies for our final container, minimizing container size. +# This Dockerfile utilizes a two step build process. It builds Chariott Intent +# Brokering with statically linked dependencies (using musl vs. glibc to +# accomplish this) for a specific architecture such that we can utilize a +# scratch container without further dependencies for our final container, +# minimizing container size. # Chariott user id ARG CHARIOTT_UID=10001 @@ -18,7 +20,7 @@ ARG CHARIOTT_UID=10001 RUN apt update && apt upgrade -y RUN apt install -y cmake protobuf-compiler wget -# unprivileged identity to run Chariott as +# unprivileged identity to run Chariott Intent Brokering service as RUN adduser \ --disabled-password \ --gecos "" \ @@ -32,7 +34,7 @@ WORKDIR /sdv COPY ./ . -RUN cargo build --release -p chariott +RUN cargo build --release -p intent-brokering #############################################################x####################################### ## Final image @@ -59,7 +61,7 @@ COPY --from=builder /etc/group /etc/group WORKDIR /sdv # Copy our build -COPY --from=builder /sdv/target/release/chariott /sdv/chariott +COPY --from=builder /sdv/target/release/intent_brokering /sdv/intent_brokering # Give chariott user ownership of the /sdv directory RUN chown -R chariott:chariott /sdv @@ -67,4 +69,4 @@ RUN chown -R chariott:chariott /sdv # Use the unprivileged chariott user during execution. USER chariott::chariott -CMD ["valgrind", "--tool=memcheck", "--xml=yes", "--xml-file=/output/out.xml", "./chariott"] +CMD ["valgrind", "--tool=memcheck", "--xml=yes", "--xml-file=/output/out.xml", "./intent_brokering"] diff --git a/build-all-containers.sh b/build-all-containers.sh index cf1350cd..481b081a 100755 --- a/build-all-containers.sh +++ b/build-all-containers.sh @@ -18,10 +18,10 @@ if [ -z "$IMAGE_TAG" ]; then fi # Build base image for all example applications -docker build --tag "chariott:base" --file ./intent_brokering/examples/applications/Dockerfile.base . +docker build --tag "intent_brokering_examples:base" --file ./intent_brokering/examples/applications/Dockerfile.base . -# Build Chariott -docker build --tag "$(concat_image_registry chariott:"$IMAGE_TAG")" --file ./intent_brokering/examples/applications/Dockerfile.generic --build-arg APP_NAME=chariott . +# Build Intent Brokering service +docker build --tag "$(concat_image_registry intent_brokering:"$IMAGE_TAG")" --file ./intent_brokering/examples/applications/Dockerfile.generic --build-arg APP_NAME=intent_brokering . # Build Examples docker build --tag "$(concat_image_registry cloud-object-detection-app:"$IMAGE_TAG")" --file ./intent_brokering/examples/applications/Dockerfile.cloud-object-detection --build-arg APP_NAME=cloud-object-detection-app . diff --git a/docs/memory-profiling.md b/docs/memory-profiling.md index d8ac9640..d510b75d 100644 --- a/docs/memory-profiling.md +++ b/docs/memory-profiling.md @@ -23,18 +23,18 @@ In case you want to build from source you can follow this [documentation](https: ## Scenario -In order to have a consistent feedback loop for Chariott and valgrind, we'll use the -load test benchmarking available in Chariott. +In order to have a consistent feedback loop for Intent Brokering and valgrind, we'll use the +load test benchmarking available in Intent Brokering. ## Running memcheck -Memcheck is the default valgrind tool for memory profiling. The usage for Chariott +Memcheck is the default valgrind tool for memory profiling. The usage for Intent Brokering together with the e2e tests is as follows: -In a dedicated terminal, run valgrind with Chariott +In a dedicated terminal, run valgrind with Intent Brokering ```bash -valgrind ./target/debug/chariott +valgrind ./target/debug/intent_brokering ``` In another terminal, run the e2e tests @@ -69,13 +69,13 @@ the end of the output. It looks like this: ## Running massif The other tool to use is **massif**. It writes its output to a file, which can be -visualized with the `ms_print` tool. The usage for Chariott together with the e2e +visualized with the `ms_print` tool. The usage for Intent Brokering together with the e2e tests is as follows: -In a dedicated terminal, run massif with Chariott +In a dedicated terminal, run massif with Intent Brokering ```bash -valgrind --tool=massif ./target/debug/chariott +valgrind --tool=massif ./target/debug/intent_brokering ``` In another terminal, run the e2e tests @@ -98,7 +98,7 @@ The output of `ms_print` looks like this (just a part of it): ```bash -------------------------------------------------------------------------------- -Command: ./target/debug/chariott +Command: ./target/debug/intent_brokering Massif arguments: (none) ms_print arguments: massif.out.7704 -------------------------------------------------------------------------------- diff --git a/intent_brokering/README.md b/intent_brokering/README.md index f64061ba..00dc67b1 100644 --- a/intent_brokering/README.md +++ b/intent_brokering/README.md @@ -11,8 +11,8 @@ - [Without Dev Container](#without-dev-container) - [Install Dependencies](#install-dependencies) - [Build all binaries and run tests natively](#build-all-binaries-and-run-tests-natively) - - [Build and run Chariott only](#build-and-run-chariott-only) -- [How to run the examples and interact with Chariott](#how-to-run-the-examples-and-interact-with-chariott) + - [Build and run Intent Brokering only](#build-and-run-intent-brokering-only) +- [How to run the examples and interact with Intent Brokering](#how-to-run-the-examples-and-interact-with-intent-brokering) - [How to run the dog mode demo](#how-to-run-the-dog-mode-demo) - [Trademarks](#trademarks) @@ -21,18 +21,18 @@ | Term | Description | | --- | --- | | Application | An application is defined as any software component. | -| Provider | A provider is also an application that in addition registers its capabilities with Chariott's service registry for other applications to consume. | -| Consuming Application | A consuming application is a client application that interacts with Chariott to look up capability providers and interact with them through Chariott or directly. | ->Note: "provider" or "consuming application" are just roles for an application. Specifically, an application can be both a Chariott "provider" and "consuming application". +| Provider | A provider is also an application that in addition registers its capabilities with the Intent Brokering service's registry for other applications to consume. | +| Consuming Application | A consuming application is a client application that interacts with the Intent Broker to look up capability providers and interact with them through the Intent Broker or directly. | +>Note: "provider" or "consuming application" are just roles for an application. Specifically, an application can be both an Intent "provider" and "consuming application". ## Concept of Intents -Intents are the main way to interact with Chariott. Once a provider registers -an intent with Chariott, other applications can use that intent to interact with +Intents are the main way to interact with the Intent Broker. Once a provider registers +an intent with the Intent Broker, other applications can use that intent to interact with the provider. The intent is a gRPC method that is defined in the provider's -protobuf definition. That definition is only used by Chariott itself. +protobuf definition. That definition is only used by the Intent Broker itself. -Chariott also provides a gRPC interface for applications to interact with +The intent broker also provides a gRPC interface for applications to interact with providers and delegates the calls based on the intent to the provider transparently. Therefore, clients don't need to know the location and details of the provider as long as their intent is fulfilled. @@ -41,7 +41,7 @@ Here is a list of the current supported intents: | Intent | Description | | --- | --- | -| Discover | Retrieve native interfaces of providers. This comes in handy if you need specific interaction with a provider that you know is available in the system and you don't want to use Chariott to interact with it. This is also used for retrieving the streaming endpoints of a provider. | +| Discover | Retrieve native interfaces of providers. This comes in handy if you need specific interaction with a provider that you know is available in the system and you don't want to use the Intent Broker to interact with it. This is also used for retrieving the streaming endpoints of a provider. | | Inspect | Support inspection of functionality, properties and events using a simple query syntax. | | Invoke | Invoke a method on a provider. | | Subscribe | Subscribe to events of a provider. Note that this does not open the streaming channel, this is done through the native streaming endpoint of the provider. | @@ -51,7 +51,7 @@ Here is a list of the current supported intents: More information can be found in the protobuf definitions in `./proto`. There is a separate document that describes the example applications and -scenarios that are supported by Chariott. It can be found +scenarios that are supported by the Intent Broker. It can be found [here](./examples/applications/README.md). ## Requirements @@ -98,8 +98,8 @@ variable to the new target folder. The following sequence works in the devcontai ```shell vscode ➜ /workspaces/chariott (main) $ sudo mkdir ../target vscode ➜ /workspaces/chariott (main) $ sudo chown vscode:vscode ../target -vscode ➜ /workspaces/chariott (main) $ CARGO_TARGET_DIR=../target cargo build -p chariott -vscode ➜ /workspaces/chariott (main) $ CARGO_TARGET_DIR=../target cargo run -p chariott +vscode ➜ /workspaces/chariott (main) $ CARGO_TARGET_DIR=../target cargo build -p intent-brokering +vscode ➜ /workspaces/chariott (main) $ CARGO_TARGET_DIR=../target cargo run -p intent-brokering ``` #### Using Podman instead of Docker @@ -134,7 +134,7 @@ with the following additions: #### Install Dependencies As stated above, the `devcontainer.json` and the Dockerfile -`.devcontainer/Dockerfile` contain a list of the plugins/tools we use for Chariott. +`.devcontainer/Dockerfile` contain a list of the plugins/tools we use for the Intent Brokering service. Below we have listed the steps to get started, but refer to those files if there are any discrepancies. This guide uses `apt` as the package manager in the examples. You may need to substitute your own @@ -189,17 +189,17 @@ cargo build --workspace cargo test --workspace ``` -#### Build and run Chariott only +#### Build and run Intent Brokering only ```bash -cargo run -p chariott +cargo run -p intent-brokering ``` -## How to run the examples and interact with Chariott +## How to run the examples and interact with Intent Brokering Refer to individual example applications' documentation for additional setup or dependencies that may be required. -As Chariott's out of the box communication protocol is gRPC, the interaction with the +As the Intent Brokering service's out of the box communication protocol is gRPC, the interaction with the examples is done through gRPC. To illustrate how to invoke the gRPC methods we use the [grpcurl](https://github.com/fullstorydev/grpcurl) command line tool with the example application **kv-app**. The **kv-app** is a key-value store that can be used to store diff --git a/intent_brokering/common/src/streaming_ess.rs b/intent_brokering/common/src/streaming_ess.rs index 979762a6..4e1b9a40 100644 --- a/intent_brokering/common/src/streaming_ess.rs +++ b/intent_brokering/common/src/streaming_ess.rs @@ -18,7 +18,7 @@ use uuid::Uuid; type EventSubSystem = ess::EventSubSystem, Box, T, Result>; /// [`StreamingEss`](StreamingEss) integrates the reusable -/// [`EventSubSystem`](ess::EventSubSystem) component with the Chariott gRPC +/// [`EventSubSystem`](ess::EventSubSystem) component with the intent broker gRPC /// streaming contract. Cloning [`StreamingEss`](StreamingEss) is cheap, it will /// not create a new instance but refer to the same underlying instance instead. #[derive(Clone)] diff --git a/intent_brokering/examples/applications/Dockerfile.base b/intent_brokering/examples/applications/Dockerfile.base index 79def7e2..d740b9de 100644 --- a/intent_brokering/examples/applications/Dockerfile.base +++ b/intent_brokering/examples/applications/Dockerfile.base @@ -5,7 +5,7 @@ ARG RUST_VERSION=1.70 FROM docker.io/library/rust:${RUST_VERSION} AS builder -# Dockerfile for building Eclipse Chariott base image +# Dockerfile for building Eclipse Chariott Intent Brokering base image # # This Dockerfile builds the packages from chariott workspace with # statically linked dependencies (using musl) for x86_64 architecture diff --git a/intent_brokering/examples/applications/Dockerfile.cloud-object-detection b/intent_brokering/examples/applications/Dockerfile.cloud-object-detection index acc8113f..a8a85c96 100644 --- a/intent_brokering/examples/applications/Dockerfile.cloud-object-detection +++ b/intent_brokering/examples/applications/Dockerfile.cloud-object-detection @@ -1,7 +1,7 @@ ##################################################################################################### ## Final image #################################################################################################### -FROM chariott:base as base +FROM intent_brokering_examples:base as base FROM alpine:latest ARG APP_NAME ENV USER_NAME=sample diff --git a/intent_brokering/examples/applications/Dockerfile.generic b/intent_brokering/examples/applications/Dockerfile.generic index 9fb21bef..6aacc023 100644 --- a/intent_brokering/examples/applications/Dockerfile.generic +++ b/intent_brokering/examples/applications/Dockerfile.generic @@ -1,7 +1,7 @@ ##################################################################################################### ## Final image #################################################################################################### -FROM chariott:base as base +FROM intent_brokering_examples:base as base FROM alpine:latest ARG APP_NAME ENV USER_NAME=sample diff --git a/intent_brokering/examples/applications/Dockerfile.kv-app.ci b/intent_brokering/examples/applications/Dockerfile.kv-app.ci index ee8fa39f..9bd044de 100644 --- a/intent_brokering/examples/applications/Dockerfile.kv-app.ci +++ b/intent_brokering/examples/applications/Dockerfile.kv-app.ci @@ -5,9 +5,9 @@ ARG RUST_VERSION=1.70 FROM docker.io/library/rust:${RUST_VERSION} AS builder -# Dockerfile for building Eclipse Chariott container +# Dockerfile for building the kv-app container # -# This Dockerfile utilizes a two step build process. It builds Chariott with +# This Dockerfile utilizes a two step build process. It builds kv-app with # statically linked dependencies (using musl vs. glibc to accomplish this) for a # specific architecture such that we can utilize a scratch container without # further dependencies for our final container, minimizing container size. @@ -29,7 +29,7 @@ RUN rustup target add x86_64-unknown-linux-musl RUN cargo build --release --target=x86_64-unknown-linux-musl --package kv-app -# unprivileged identity to run Chariott as +# unprivileged identity to run kv-app as RUN adduser \ --disabled-password \ --gecos "" \ @@ -45,7 +45,7 @@ RUN adduser \ FROM alpine:latest ARG APP_NAME ARG USER_NAME -# Import Chariott user and group from builder. +# Import kv-app user and group from builder. COPY --from=builder /etc/passwd /etc/passwd COPY --from=builder /etc/group /etc/group @@ -54,6 +54,6 @@ WORKDIR /sdv # Copy our build COPY --from=builder /sdv/target/x86_64-unknown-linux-musl/release/kv-app /sdv/kv-app -# Use the unprivileged chariott user during execution. +# Use the unprivileged kv-app user during execution. USER ${USER_NAME}:${USER_NAME} CMD ["sh", "-c", "./kv-app"] diff --git a/intent_brokering/examples/applications/Dockerfile.lt-provider-app.ci b/intent_brokering/examples/applications/Dockerfile.lt-provider-app.ci index 119395f1..142012e2 100644 --- a/intent_brokering/examples/applications/Dockerfile.lt-provider-app.ci +++ b/intent_brokering/examples/applications/Dockerfile.lt-provider-app.ci @@ -5,12 +5,13 @@ ARG RUST_VERSION=1.70 FROM docker.io/library/rust:${RUST_VERSION} AS builder -# Dockerfile for building Eclipse Chariott container +# Dockerfile for building the "latency test" container # -# This Dockerfile utilizes a two step build process. It builds Chariott with -# statically linked dependencies (using musl vs. glibc to accomplish this) for a -# specific architecture such that we can utilize a scratch container without -# further dependencies for our final container, minimizing container size. +# This Dockerfile utilizes a two step build process. It builds "latency test" +# with statically linked dependencies (using musl vs. glibc to accomplish this) +# for a specific architecture such that we can utilize a scratch container +# without further dependencies for our final container, minimizing container +# size. # Examples user id ARG SAMPLE_UID=10001 @@ -29,7 +30,7 @@ RUN rustup target add x86_64-unknown-linux-musl RUN cargo build --release --target=x86_64-unknown-linux-musl --package lt-provider-app -# unprivileged identity to run Chariott as +# unprivileged identity to run "latency test" as RUN adduser \ --disabled-password \ --gecos "" \ @@ -45,7 +46,7 @@ RUN adduser \ FROM alpine:latest ARG APP_NAME ARG USER_NAME -# Import Chariott user and group from builder. +# Import "latency test" user and group from builder. COPY --from=builder /etc/passwd /etc/passwd COPY --from=builder /etc/group /etc/group @@ -54,6 +55,6 @@ WORKDIR /sdv # Copy our build COPY --from=builder /sdv/target/x86_64-unknown-linux-musl/release/lt-provider-app /sdv/lt-provider-app -# Use the unprivileged chariott user during execution. +# Use the unprivileged "latency test" user during execution. USER ${USER_NAME}:${USER_NAME} CMD ["sh", "-c", "./lt-provider-app"] diff --git a/intent_brokering/examples/applications/Dockerfile.mock-vas b/intent_brokering/examples/applications/Dockerfile.mock-vas index 2020ad21..bbd2e84c 100644 --- a/intent_brokering/examples/applications/Dockerfile.mock-vas +++ b/intent_brokering/examples/applications/Dockerfile.mock-vas @@ -1,7 +1,7 @@ ##################################################################################################### ## Final image #################################################################################################### -FROM chariott:base as base +FROM intent_brokering_examples:base as base FROM alpine:latest ARG APP_NAME ENV USER_NAME=sample diff --git a/intent_brokering/examples/applications/Dockerfile.simulated-camera b/intent_brokering/examples/applications/Dockerfile.simulated-camera index bdf11f1f..5ebe1431 100644 --- a/intent_brokering/examples/applications/Dockerfile.simulated-camera +++ b/intent_brokering/examples/applications/Dockerfile.simulated-camera @@ -1,7 +1,7 @@ ##################################################################################################### ## Final image #################################################################################################### -FROM chariott:base as base +FROM intent_brokering_examples:base as base FROM alpine:latest ARG APP_NAME ENV USER_NAME=sample diff --git a/intent_brokering/examples/applications/cloud-object-detection/src/intent_provider.rs b/intent_brokering/examples/applications/cloud-object-detection/src/intent_provider.rs index 669b6efd..44d61084 100644 --- a/intent_brokering/examples/applications/cloud-object-detection/src/intent_provider.rs +++ b/intent_brokering/examples/applications/cloud-object-detection/src/intent_provider.rs @@ -13,7 +13,7 @@ use tracing::error; use crate::detection::DetectionLogic; use examples_common::{ - chariott::inspection::{fulfill, Entry}, + intent_brokering::inspection::{fulfill, Entry}, examples::detection::DetectRequest, }; diff --git a/intent_brokering/examples/applications/cloud-object-detection/src/main.rs b/intent_brokering/examples/applications/cloud-object-detection/src/main.rs index c6eab63b..bf96eb0a 100644 --- a/intent_brokering/examples/applications/cloud-object-detection/src/main.rs +++ b/intent_brokering/examples/applications/cloud-object-detection/src/main.rs @@ -5,7 +5,7 @@ mod detection; mod intent_provider; -use examples_common::chariott; +use examples_common::intent_brokering; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -16,10 +16,10 @@ use tonic::transport::Server; use crate::intent_provider::IntentProvider; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - let (url, socket_address) = chariott::provider::register( + let (url, socket_address) = intent_brokering::provider::register( "sdv.cloud-detection", "0.0.1", "sdv.detection", diff --git a/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs b/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs index e8b4535a..30a1a5fc 100644 --- a/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs +++ b/intent_brokering/examples/applications/dog-mode-logic/src/dog_mode_status.rs @@ -5,8 +5,8 @@ use anyhow::{anyhow, Error}; use async_stream::try_stream; use examples_common::{ - chariott::{ - api::{Chariott, ChariottExt as _, GrpcChariott}, + intent_brokering::{ + api::{IntentBrokering, IntentBrokeringExt as _, GrpcIntentBrokering}, value::Value, }, examples::proto::detection::{DetectRequest, DetectResponse}, @@ -19,10 +19,10 @@ use tracing::{info, warn}; use crate::{DogModeState, DOG_MODE_STATUS_ID, KEY_VALUE_STORE_NAMESPACE}; pub(crate) async fn stream_dog_mode_status( - mut chariott: GrpcChariott, + mut intent_broker: GrpcIntentBrokering, state: &mut DogModeState, ) -> Result>, Error> { - if let ok @ Ok(_) = detect_dog(chariott.clone()).await { + if let ok @ Ok(_) = detect_dog(intent_broker.clone()).await { info!("Using automated dog detection."); // The dog mode logic application is responsible for updating the @@ -34,7 +34,7 @@ pub(crate) async fn stream_dog_mode_status( warn!("Automatic dog detection failed. Falling back to using an external application to turn on the dog mode."); Ok(Box::pin( - chariott + intent_broker .listen(KEY_VALUE_STORE_NAMESPACE, [DOG_MODE_STATUS_ID.into()]) .await? .map_err(|e| e.into()) @@ -48,7 +48,7 @@ pub(crate) async fn stream_dog_mode_status( } async fn detect_dog( - mut chariott: GrpcChariott, + mut intent_broker: GrpcIntentBrokering, ) -> Result>, Error> { const CAMERA_NAMESPACE: &str = "sdv.camera.simulated"; const FRAMES_METADATA_KEY: &str = "frames_per_minute"; @@ -61,22 +61,22 @@ async fn detect_dog( /// namespace. If there are intents, we assume that those are the /// supported intent. async fn ensure_vehicle_functionality( - chariott: &mut impl Chariott, + intent_broker: &mut impl IntentBrokering, namespace: &str, ) -> Result<(), Error> { - if chariott.inspect(SYSTEM_REGISTRY_NAMESPACE, namespace).await?.is_empty() { + if intent_broker.inspect(SYSTEM_REGISTRY_NAMESPACE, namespace).await?.is_empty() { Err(anyhow!("Vehicle does not have registrations for namespace '{namespace}'.")) } else { Ok(()) } } - ensure_vehicle_functionality(&mut chariott, CAMERA_NAMESPACE).await?; - ensure_vehicle_functionality(&mut chariott, OBJECT_DETECTION_NAMESPACE).await?; + ensure_vehicle_functionality(&mut intent_broker, CAMERA_NAMESPACE).await?; + ensure_vehicle_functionality(&mut intent_broker, OBJECT_DETECTION_NAMESPACE).await?; // Stream images from the camera at the highest frame rate. - let (subscription_key, frames) = chariott + let (subscription_key, frames) = intent_broker .inspect(CAMERA_NAMESPACE, "**") .await? .into_iter() @@ -93,15 +93,15 @@ async fn detect_dog( info!("Streaming with frame rate of {frames}fpm."); - let images = chariott.listen(CAMERA_NAMESPACE, [subscription_key]).await?; + let images = intent_broker.listen(CAMERA_NAMESPACE, [subscription_key]).await?; let dog_mode_state_stream = try_stream! { for await image in images { - yield image_contains_dog(&mut chariott, image?.data).await?; + yield image_contains_dog(&mut intent_broker, image?.data).await?; } }; - async fn image_contains_dog(chariott: &mut impl Chariott, image: Value) -> Result { + async fn image_contains_dog(intent_broker: &mut impl IntentBrokering, image: Value) -> Result { use prost::Message; let (media_type, bytes) = image @@ -113,7 +113,7 @@ async fn detect_dog( let mut detect_request_bytes = vec![]; detect_request.encode(&mut detect_request_bytes)?; - let detection_result = chariott + let detection_result = intent_broker .invoke( OBJECT_DETECTION_NAMESPACE, DETECT_COMMAND_NAME, diff --git a/intent_brokering/examples/applications/dog-mode-logic/src/main.rs b/intent_brokering/examples/applications/dog-mode-logic/src/main.rs index 63a5772a..548d0756 100644 --- a/intent_brokering/examples/applications/dog-mode-logic/src/main.rs +++ b/intent_brokering/examples/applications/dog-mode-logic/src/main.rs @@ -9,8 +9,8 @@ use std::{ use anyhow::{anyhow, Error}; use dog_mode_status::stream_dog_mode_status; -use examples_common::chariott::{ - api::{Chariott, ChariottExt as _, GrpcChariott}, +use examples_common::intent_brokering::{ + api::{IntentBrokering, IntentBrokeringExt as _, GrpcIntentBrokering}, value::Value, }; use tokio::{select, time::sleep_until}; @@ -83,7 +83,7 @@ pub async fn main() -> Result<(), Error> { .finish() .init(); - let mut chariott = GrpcChariott::connect().await?; + let mut intent_broker = GrpcIntentBrokering::connect().await?; let mut state = DogModeState::new(); // Inspect vehicle hardware to assert that all requirements are met before @@ -102,7 +102,7 @@ pub async fn main() -> Result<(), Error> { (ACTIVATE_AIR_CONDITIONING_ID, /*..*/ MEMBER_TYPE_COMMAND, "IAcmeAirconControl"), ] { inspect_dependency( - &mut chariott, + &mut intent_broker, path, &[(MEMBER_TYPE, member_type.into()), (TYPE, /*..*/ r#type.into())], ) @@ -114,7 +114,7 @@ pub async fn main() -> Result<(), Error> { (SET_UI_MESSAGE_ID, "ISetUiMessage", &mut state.set_ui_message_disabled), ] { if let Err(e) = inspect_dependency( - &mut chariott, + &mut intent_broker, path, &[(MEMBER_TYPE, MEMBER_TYPE_COMMAND.into()), (TYPE, /*..*/ r#type.into())], ) @@ -130,11 +130,11 @@ pub async fn main() -> Result<(), Error> { } async fn inspect_dependency( - chariott: &mut GrpcChariott, + intent_broker: &mut GrpcIntentBrokering, path: impl Into> + Send, expected_properties: &[(&str, Value)], ) -> Result<(), Error> { - let inspection_result = chariott.inspect(VDT_NAMESPACE, path).await?; + let inspection_result = intent_broker.inspect(VDT_NAMESPACE, path).await?; inspection_result.iter().map(|m| { expected_properties.iter().map(|(expected_key, expected_value)| m.get(*expected_key) .ok_or_else(|| anyhow!("Member does not specify {expected_key:?}.")) @@ -154,7 +154,7 @@ pub async fn main() -> Result<(), Error> { // Set up the VDT and dog mode status streaming. - let mut vdt_stream = chariott + let mut vdt_stream = intent_broker .listen( VDT_NAMESPACE, [ @@ -165,7 +165,7 @@ pub async fn main() -> Result<(), Error> { ) .await?; - let mut dog_mode_status_stream = stream_dog_mode_status(chariott.clone(), &mut state).await?; + let mut dog_mode_status_stream = stream_dog_mode_status(intent_broker.clone(), &mut state).await?; let mut next_timer_wakeup = Instant::now() + TIMEOUT_EVALUATION_INTERVAL; @@ -176,7 +176,7 @@ pub async fn main() -> Result<(), Error> { let state_update = select! { _ = sleep_until(next_timer_wakeup.into()) => { next_timer_wakeup = Instant::now() + TIMEOUT_EVALUATION_INTERVAL; - if let Some(new_state) = on_dog_mode_timer(&state, &mut chariott).await? { + if let Some(new_state) = on_dog_mode_timer(&state, &mut intent_broker).await? { state = new_state; } @@ -214,7 +214,7 @@ pub async fn main() -> Result<(), Error> { state = new_state } - match run_dog_mode(&state, &previous_state, &mut chariott).await { + match run_dog_mode(&state, &previous_state, &mut intent_broker).await { Ok(Some(new_state)) => state = new_state, Err(e) => error!("{e:?}"), Ok(None) => {} @@ -225,7 +225,7 @@ pub async fn main() -> Result<(), Error> { async fn run_dog_mode( state: &DogModeState, previous_state: &DogModeState, - chariott: &mut impl Chariott, + intent_broker: &mut impl IntentBrokering, ) -> Result, Error> { if state == previous_state { return Ok(None); @@ -250,7 +250,7 @@ async fn run_dog_mode( log_change("Battery level", state, previous_state, |s| s.battery_level)?; if state.write_dog_mode_status && (state.dogmode_status != previous_state.dogmode_status) { - chariott + intent_broker .write(KEY_VALUE_STORE_NAMESPACE, DOG_MODE_STATUS_ID, state.dogmode_status.into()) .await?; } @@ -258,7 +258,7 @@ async fn run_dog_mode( // Immediately end, if dog mode is disabled if !state.dogmode_status { if previous_state.dogmode_status { - activate_air_conditioning(chariott, false).await?; + activate_air_conditioning(intent_broker, false).await?; } return Ok(None); @@ -269,7 +269,7 @@ async fn run_dog_mode( // If the temperature falls below the set minimum, turn off air conditioning if MIN_TEMPERATURE >= state.temperature && state.air_conditioning_active { if let Some(last_air_conditioning_invocation_time) = - activate_air_conditioning_with_throttling(false, state, chariott).await? + activate_air_conditioning_with_throttling(false, state, intent_broker).await? { output_state = Some(DogModeState { last_air_conditioning_invocation_time, ..*state }); } @@ -278,7 +278,7 @@ async fn run_dog_mode( // If all criteria is fulfilled, activate air conditioning if state.temperature > MAX_TEMPERATURE && !state.air_conditioning_active { if let Some(last_air_conditioning_invocation_time) = - activate_air_conditioning_with_throttling(true, state, chariott).await? + activate_air_conditioning_with_throttling(true, state, intent_broker).await? { output_state = Some(DogModeState { last_air_conditioning_invocation_time, @@ -291,13 +291,13 @@ async fn run_dog_mode( async fn activate_air_conditioning_with_throttling( value: bool, state: &DogModeState, - chariott: &mut impl Chariott, + intent_broker: &mut impl IntentBrokering, ) -> Result, Error> { let now = Instant::now(); if now > state.last_air_conditioning_invocation_time + FUNCTION_INVOCATION_THROTTLING_DURATION { - activate_air_conditioning(chariott, value).await?; + activate_air_conditioning(intent_broker, value).await?; return Ok(Some(now)); } @@ -306,32 +306,32 @@ async fn run_dog_mode( // Air conditioning state was changed by the provider. if state.air_conditioning_active && !previous_state.air_conditioning_active { - send_notification(chariott, "The car is now being cooled.", state).await?; - set_ui_message(chariott, "The car is cooled, no need to worry.", state).await?; + send_notification(intent_broker, "The car is now being cooled.", state).await?; + set_ui_message(intent_broker, "The car is cooled, no need to worry.", state).await?; } // If the battery level fell below a threshold value, send a warning to the car owner. if previous_state.battery_level > LOW_BATTERY_LEVEL && state.battery_level <= LOW_BATTERY_LEVEL { - send_notification(chariott, "The battery is low, please return to the car.", state).await?; - set_ui_message(chariott, "The battery is low, the animal is in danger.", state).await?; + send_notification(intent_broker, "The battery is low, please return to the car.", state).await?; + set_ui_message(intent_broker, "The battery is low, the animal is in danger.", state).await?; } async fn activate_air_conditioning( - chariott: &mut impl Chariott, + intent_broker: &mut impl IntentBrokering, value: bool, ) -> Result<(), Error> { - _ = chariott.invoke(VDT_NAMESPACE, ACTIVATE_AIR_CONDITIONING_ID, [value.into()]).await?; + _ = intent_broker.invoke(VDT_NAMESPACE, ACTIVATE_AIR_CONDITIONING_ID, [value.into()]).await?; Ok(()) } async fn send_notification( - chariott: &mut impl Chariott, + intent_broker: &mut impl IntentBrokering, message: &str, state: &DogModeState, ) -> Result<(), Error> { if !state.send_notification_disabled { - _ = chariott.invoke(VDT_NAMESPACE, SEND_NOTIFICATION_ID, [message.into()]).await?; + _ = intent_broker.invoke(VDT_NAMESPACE, SEND_NOTIFICATION_ID, [message.into()]).await?; Ok(()) } else { // as this is an optional method we don't care @@ -340,12 +340,12 @@ async fn run_dog_mode( } async fn set_ui_message( - chariott: &mut impl Chariott, + intent_broker: &mut impl IntentBrokering, message: &str, state: &DogModeState, ) -> Result<(), Error> { if !state.set_ui_message_disabled { - _ = chariott.invoke(VDT_NAMESPACE, SET_UI_MESSAGE_ID, [message.into()]).await?; + _ = intent_broker.invoke(VDT_NAMESPACE, SET_UI_MESSAGE_ID, [message.into()]).await?; Ok(()) } else { // as this is an optional method we don't care @@ -358,7 +358,7 @@ async fn run_dog_mode( async fn on_dog_mode_timer( state: &DogModeState, - chariott: &mut impl Chariott, + intent_broker: &mut impl IntentBrokering, ) -> Result, Error> { if let Some(air_conditioning_activation_time) = state.air_conditioning_activation_time { if state.air_conditioning_active { @@ -366,7 +366,7 @@ async fn on_dog_mode_timer( } else if Instant::now() > air_conditioning_activation_time + AIR_CONDITIONING_ACTIVATION_TIMEOUT { - _ = chariott + _ = intent_broker .invoke( VDT_NAMESPACE, SEND_NOTIFICATION_ID, @@ -384,7 +384,7 @@ async fn on_dog_mode_timer( #[cfg(test)] mod tests { use async_trait::async_trait; - use examples_common::chariott::{api::Service, inspection::Entry}; + use examples_common::intent_brokering::{api::Service, inspection::Entry}; use intent_brokering_common::error::Error; use super::*; @@ -397,7 +397,7 @@ mod tests { } #[async_trait] - impl Chariott for CarControllerMock { + impl IntentBrokering for CarControllerMock { async fn invoke + Send>( &mut self, namespace: impl Into> + Send, diff --git a/intent_brokering/examples/applications/dog-mode-ui/src/Program.cs b/intent_brokering/examples/applications/dog-mode-ui/src/Program.cs index 4cd80ea1..e63e22a9 100644 --- a/intent_brokering/examples/applications/dog-mode-ui/src/Program.cs +++ b/intent_brokering/examples/applications/dog-mode-ui/src/Program.cs @@ -250,7 +250,7 @@ public void Add(IDisposable disposable) => cancellationToken: cancellationToken); var streamingAddress = streamingAddressCandidates.Fulfillment.Discover.Services - .First(s => s.SchemaReference == "chariott.streaming.v1" && s.SchemaKind == "grpc+proto") + .First(s => s.SchemaReference == "intent_brokering.streaming.v1" && s.SchemaKind == "grpc+proto") .Url; var channel = GrpcChannel.ForAddress(streamingAddress, new GrpcChannelOptions diff --git a/intent_brokering/examples/applications/invoke-command/src/main.rs b/intent_brokering/examples/applications/invoke-command/src/main.rs index af881ce4..111c29bf 100644 --- a/intent_brokering/examples/applications/invoke-command/src/main.rs +++ b/intent_brokering/examples/applications/invoke-command/src/main.rs @@ -6,7 +6,7 @@ mod intent_provider; use std::sync::Arc; -use examples_common::chariott; +use examples_common::intent_brokering; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -17,10 +17,10 @@ use tonic::transport::Server; use crate::intent_provider::IntentProvider; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - let (url, socket_address) = chariott::provider::register( + let (url, socket_address) = intent_brokering::provider::register( "sdv.invoke.controller", "0.0.1", "sdv.invoke.controller", diff --git a/intent_brokering/examples/applications/invoke_object_detection.sh b/intent_brokering/examples/applications/invoke_object_detection.sh index 6f1118f5..37154a0a 100755 --- a/intent_brokering/examples/applications/invoke_object_detection.sh +++ b/intent_brokering/examples/applications/invoke_object_detection.sh @@ -52,6 +52,6 @@ EOF grpcurl -plaintext --import-path ../../proto/ -import-path ./proto \ -use-reflection -proto ./proto/examples/detection/v1/detection.proto \ - -d @ "${CHARIOTT_ADDRESS:-0.0.0.0:4243}" \ + -d @ "${INTENT_BROKER_ADDRESS:-0.0.0.0:4243}" \ intent_brokering.runtime.v1.IntentBrokeringService/Fulfill < <(echo "$REQ") \ | jq .fulfillment.invoke.return.any.entries diff --git a/intent_brokering/examples/applications/kv-app/README.md b/intent_brokering/examples/applications/kv-app/README.md index 96dcc5bc..c388445a 100644 --- a/intent_brokering/examples/applications/kv-app/README.md +++ b/intent_brokering/examples/applications/kv-app/README.md @@ -10,7 +10,7 @@ channel. Start the Intent Brokering Service followed by this application: ```bash -cargo run -p intent_brokering & +cargo run -p intent-brokering & cargo run -p kv-app & ``` diff --git a/intent_brokering/examples/applications/kv-app/src/intent_provider.rs b/intent_brokering/examples/applications/kv-app/src/intent_provider.rs index 0ff3e639..0f2b1d94 100644 --- a/intent_brokering/examples/applications/kv-app/src/intent_provider.rs +++ b/intent_brokering/examples/applications/kv-app/src/intent_provider.rs @@ -5,7 +5,7 @@ use std::{collections::HashMap, sync::Arc}; use async_trait::async_trait; -use examples_common::chariott::{self, streaming::ProtoExt as _}; +use examples_common::intent_brokering::{self, streaming::ProtoExt as _}; use tonic::{Request, Response, Status}; use url::Url; @@ -18,7 +18,7 @@ use intent_brokering_proto::{ provider::{provider_service_server::ProviderService, FulfillRequest, FulfillResponse}, }; -pub type StreamingStore = chariott::streaming::StreamingStore; +pub type StreamingStore = intent_brokering::streaming::StreamingStore; pub struct IntentProvider { url: Url, @@ -60,7 +60,7 @@ impl ProviderService for IntentProvider { services: vec![Service { url: self.url.to_string(), schema_kind: "grpc+proto".to_owned(), - schema_reference: "chariott.streaming.v1".to_owned(), + schema_reference: "intent_brokering.streaming.v1".to_owned(), metadata: HashMap::new(), }], })), diff --git a/intent_brokering/examples/applications/kv-app/src/main.rs b/intent_brokering/examples/applications/kv-app/src/main.rs index 84cde2d3..de527109 100644 --- a/intent_brokering/examples/applications/kv-app/src/main.rs +++ b/intent_brokering/examples/applications/kv-app/src/main.rs @@ -6,7 +6,7 @@ mod intent_provider; use std::sync::Arc; -use examples_common::chariott; +use examples_common::intent_brokering; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -18,10 +18,10 @@ use tonic::transport::Server; use crate::intent_provider::{IntentProvider, StreamingStore}; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - let (url, socket_address) = chariott::provider::register( + let (url, socket_address) = intent_brokering::provider::register( "sdv.key-value-store", "0.0.1", "sdv.kvs", diff --git a/intent_brokering/examples/applications/local-object-detection/src/intent_provider.rs b/intent_brokering/examples/applications/local-object-detection/src/intent_provider.rs index f01d6de1..e2de922e 100644 --- a/intent_brokering/examples/applications/local-object-detection/src/intent_provider.rs +++ b/intent_brokering/examples/applications/local-object-detection/src/intent_provider.rs @@ -13,7 +13,7 @@ use tracing::error; use crate::detection::DetectionLogic; use examples_common::{ - chariott::inspection::{fulfill, Entry}, + intent_brokering::inspection::{fulfill, Entry}, examples::detection::DetectRequest, }; diff --git a/intent_brokering/examples/applications/local-object-detection/src/main.rs b/intent_brokering/examples/applications/local-object-detection/src/main.rs index 4eddbf05..7f691860 100644 --- a/intent_brokering/examples/applications/local-object-detection/src/main.rs +++ b/intent_brokering/examples/applications/local-object-detection/src/main.rs @@ -5,7 +5,7 @@ mod detection; mod intent_provider; -use examples_common::chariott; +use examples_common::intent_brokering; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -16,10 +16,10 @@ use tonic::transport::Server; use crate::intent_provider::IntentProvider; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - let (url, socket_address) = chariott::provider::register( + let (url, socket_address) = intent_brokering::provider::register( "sdv.local-detection", "0.0.1", "sdv.detection", diff --git a/intent_brokering/examples/applications/lt-consumer/src/main.rs b/intent_brokering/examples/applications/lt-consumer/src/main.rs index 2bc28974..04c4a21f 100644 --- a/intent_brokering/examples/applications/lt-consumer/src/main.rs +++ b/intent_brokering/examples/applications/lt-consumer/src/main.rs @@ -3,9 +3,9 @@ // SPDX-License-Identifier: MIT use bollard::{container::StatsOptions, Docker}; -use examples_common::chariott::{ +use examples_common::intent_brokering::{ self, - api::{Chariott, GrpcChariott}, + api::{IntentBrokering, GrpcIntentBrokering}, value::Value, }; use futures_util::stream::StreamExt; @@ -28,7 +28,7 @@ use std::{ use tokio::time::{sleep, sleep_until}; use tracing::{debug, error, info, warn}; -const CHARIOTT_CONTAINER_NAME: &str = "chariott"; +const INTENT_BROKERING_CONTAINER_NAME: &str = "intent_broker"; const LT_PROVIDER_NAMESPACE: &str = "lt.provider"; // How many invoke fulfillments to schedule. @@ -50,7 +50,7 @@ const RESULT_FILE: &str = "lt-output/app.out"; const RESULT_FILE_DOCKER: &str = "lt-output/docker.out"; const SAMPLE_RATE: u64 = 50; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { let invoke_count: u64 = env(TARGET_INVOKE_COUNT_ENV).unwrap(); @@ -58,7 +58,7 @@ async fn wain() -> Result<(), Error> { let collect_docker_stats = env(COLLECT_DOCKER_STATS_ENV).unwrap_or(false); let chunk_execution_duration = Duration::from_millis(1_000 * CHUNK_SIZE / target_rate as u64); - let chariott = GrpcChariott::connect().await?; + let intent_broker = GrpcIntentBrokering::connect().await?; let latency_metric = Arc::new(Mutex::new(Summary::with_defaults())); let invoke_fulfillments = Arc::new(AtomicUsize::new(0)); @@ -99,7 +99,7 @@ async fn wain() -> Result<(), Error> { break; } - let mut chariott = chariott.clone(); + let mut intent_broker = intent_broker.clone(); let latency_metric = Arc::clone(&latency_metric); let invoke_fulfillments = Arc::clone(&invoke_fulfillments); @@ -109,7 +109,7 @@ async fn wain() -> Result<(), Error> { // Only the namespace matters when invoking. The load testing // provider will not take action based on payload or command. - let sent_value = chariott.invoke(LT_PROVIDER_NAMESPACE, "foo", [Value::NULL]).await; + let sent_value = intent_broker.invoke(LT_PROVIDER_NAMESPACE, "foo", [Value::NULL]).await; if let Some(request_instant) = now { let latency = request_instant.elapsed().as_millis() as _; @@ -200,7 +200,7 @@ async fn evaluate_docker_stats( let docker = Docker::connect_with_local_defaults() .map_err_with("could not connect with defaults to docker")?; let mut stats = docker.stats( - CHARIOTT_CONTAINER_NAME, + INTENT_BROKERING_CONTAINER_NAME, Some(StatsOptions { stream: true, ..Default::default() }), ); diff --git a/intent_brokering/examples/applications/lt-provider/src/main.rs b/intent_brokering/examples/applications/lt-provider/src/main.rs index 469bf5fc..81047246 100644 --- a/intent_brokering/examples/applications/lt-provider/src/main.rs +++ b/intent_brokering/examples/applications/lt-provider/src/main.rs @@ -7,8 +7,8 @@ use std::{ time::Duration, }; -use examples_common::chariott; -use examples_common::chariott::value::Value; +use examples_common::intent_brokering; +use examples_common::intent_brokering::value::Value; use intent_brokering_common::{ config::env, error::{Error, ResultExt as _}, @@ -34,10 +34,10 @@ const LATENCY_MEAN_ENV: &str = "LATENCY_MEAN"; // Standard deviation of latency distribution in milliseconds. const LATENCY_STD_DEV_ENV: &str = "LATENCY_STD_DEV"; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - let (url, socket_address) = chariott::provider::register( + let (url, socket_address) = intent_brokering::provider::register( "lt.provider", "0.0.1", "lt.provider", diff --git a/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs b/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs index 6e183b17..e0720880 100644 --- a/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs +++ b/intent_brokering/examples/applications/mock-vas/src/intent_provider.rs @@ -7,10 +7,10 @@ use std::sync::Arc; use std::vec; use async_trait::async_trait; -use examples_common::chariott; -use examples_common::chariott::inspection::{fulfill, Entry}; -use examples_common::chariott::streaming::ProtoExt as _; -use examples_common::chariott::value::Value; +use examples_common::intent_brokering; +use examples_common::intent_brokering::inspection::{fulfill, Entry}; +use examples_common::intent_brokering::streaming::ProtoExt as _; +use examples_common::intent_brokering::value::Value; use intent_brokering_proto::{ common::{ discover_fulfillment::Service, DiscoverFulfillment, FulfillmentEnum, FulfillmentMessage, @@ -30,10 +30,10 @@ pub const ACTIVATE_AIR_CONDITIONING_COMMAND: &str = "Vehicle.Cabin.HVAC.IsAirCon pub const SEND_NOTIFICATION_COMMAND: &str = "send_notification"; pub const SET_UI_MESSAGE_COMMAND: &str = "set_ui_message"; -const SCHEMA_VERSION_STREAMING: &str = "chariott.streaming.v1"; +const SCHEMA_VERSION_STREAMING: &str = "intent_brokering.streaming.v1"; const SCHEMA_REFERENCE: &str = "grpc+proto"; -pub type StreamingStore = chariott::streaming::StreamingStore; +pub type StreamingStore = intent_brokering::streaming::StreamingStore; pub struct IntentProvider { url: Url, diff --git a/intent_brokering/examples/applications/mock-vas/src/main.rs b/intent_brokering/examples/applications/mock-vas/src/main.rs index a920f84b..ac1339d5 100644 --- a/intent_brokering/examples/applications/mock-vas/src/main.rs +++ b/intent_brokering/examples/applications/mock-vas/src/main.rs @@ -6,16 +6,16 @@ mod communication; mod intent_provider; mod simulation; -use examples_common::chariott; +use examples_common::intent_brokering; use intent_brokering_common::error::Error; use intent_brokering_proto::runtime::{ intent_registration::Intent, intent_service_registration::ExecutionLocality, }; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - let (url, socket_address) = chariott::provider::register( + let (url, socket_address) = intent_brokering::provider::register( "sdv.mock-vas", "0.0.1", "sdv.vdt", diff --git a/intent_brokering/examples/applications/mock-vas/src/simulation.rs b/intent_brokering/examples/applications/mock-vas/src/simulation.rs index 4455d8d7..3e79c0d5 100644 --- a/intent_brokering/examples/applications/mock-vas/src/simulation.rs +++ b/intent_brokering/examples/applications/mock-vas/src/simulation.rs @@ -2,7 +2,7 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -use examples_common::chariott::value::Value; +use examples_common::intent_brokering::value::Value; use intent_brokering_common::error::{Error, ResultExt}; use std::{env, sync::Arc}; use tokio::sync::broadcast::{self, Sender}; diff --git a/intent_brokering/examples/applications/simple-provider/src/main.rs b/intent_brokering/examples/applications/simple-provider/src/main.rs index 0be479d1..0e152d74 100644 --- a/intent_brokering/examples/applications/simple-provider/src/main.rs +++ b/intent_brokering/examples/applications/simple-provider/src/main.rs @@ -8,7 +8,7 @@ use std::{net::SocketAddr, sync::Arc, time::Duration}; use url::Url; -use examples_common::chariott; +use examples_common::intent_brokering; use intent_brokering_common::error::Error; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -32,15 +32,15 @@ struct RegisterParams { version: String, intents: Vec, url: String, - chariott_url: String, + intent_brokering_url: String, locality: ExecutionLocality, } -async fn connect_chariott_client( +async fn connect_intent_brokering_client( client: &mut Option>, - chariott_url: String, + intent_brokering_url: String, ) -> Result<(), Error> { - *client = Some(IntentBrokeringServiceClient::connect(chariott_url).await.map_err(|e| { + *client = Some(IntentBrokeringServiceClient::connect(intent_brokering_url).await.map_err(|e| { *client = None; // Set client back to None on error. Error::from_error("Could not connect to client", Box::new(e)) })?); @@ -54,7 +54,7 @@ async fn register_and_announce_once( ) -> Result<(), Error> { // If there is no client, need to attempt connection. if client.is_none() { - connect_chariott_client(client, reg_params.chariott_url).await?; + connect_intent_brokering_client(client, reg_params.intent_brokering_url).await?; } let service = Some(IntentServiceRegistration { @@ -66,19 +66,19 @@ async fn register_and_announce_once( let announce_req = AnnounceRequest { service: service.clone() }; - // Always announce to Chariott. + // Always announce to IntentBrokering. let registration_state = client .as_mut() .expect("No client found") .announce(announce_req.clone()) .await - .map_err(|e| Error::from_error("Error announcing to Chariott.", Box::new(e)))? + .map_err(|e| Error::from_error("Error announcing to IntentBrokering.", Box::new(e)))? .into_inner() .registration_state; - // Only attempt registration with Chariott if the announced state is 'ANNOUNCED'. - // The 'ANNOUNCED' state means that this service is not currently registered in Chariott. - // This also handles re-registration if Chariott crashes and comes back online. + // Only attempt registration with IntentBrokering if the announced state is 'ANNOUNCED'. + // The 'ANNOUNCED' state means that this service is not currently registered in IntentBrokering. + // This also handles re-registration if IntentBrokering crashes and comes back online. if registration_state == RegistrationState::Announced as i32 { let register_req = RegisterRequest { service: service.clone(), @@ -92,14 +92,14 @@ async fn register_and_announce_once( .collect(), }; - tracing::info!("Registered with Chariott runtime: {:?}", register_req); + tracing::info!("Registered with IntentBrokering runtime: {:?}", register_req); _ = client .as_mut() .expect("No client found") .register(register_req.clone()) .await - .map_err(|e| Error::from_error("Error registering with Chariott.", Box::new(e)))?; + .map_err(|e| Error::from_error("Error registering with IntentBrokering.", Box::new(e)))?; } Ok(()) @@ -131,11 +131,11 @@ async fn register_and_announce_provider( } // This macro sets up tracing and exit code handling. -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - // Intitialize addresses for provider and chariott communication. - let chariott_url = "http://0.0.0.0:4243".to_string(); // DevSkim: ignore DS137138 + // Intitialize addresses for provider and intent_brokering communication. + let intent_brokering_url = "http://0.0.0.0:4243".to_string(); // DevSkim: ignore DS137138 let base_provider_address = "0.0.0.0:50064".to_string(); let provider_url_str = format!("http://{}", base_provider_address.clone()); // DevSkim: ignore DS137138 let socket_address: SocketAddr = base_provider_address @@ -151,7 +151,7 @@ async fn wain() -> Result<(), Error> { version: "0.0.1".to_string(), intents: [Intent::Discover].to_vec(), url: provider_url_str.clone(), - chariott_url, + intent_brokering_url, locality: ExecutionLocality::Local, }; diff --git a/intent_brokering/examples/applications/simulated-camera/README.md b/intent_brokering/examples/applications/simulated-camera/README.md index d3567557..61e94d92 100644 --- a/intent_brokering/examples/applications/simulated-camera/README.md +++ b/intent_brokering/examples/applications/simulated-camera/README.md @@ -7,7 +7,7 @@ manual mode where you specify the frame rate event yourself. ## To run the application -1. Start intent brokering runtime by executing `cargo run -p intent_brokering` from the root directory +1. Start intent brokering runtime by executing `cargo run -p intent-brokering` from the root directory 2. Navigate to `intent_brokering/examples/applications/simulated-camera` directory 3. Create a `images` directory and place there all the `.jpg` files you want the camera application to stream diff --git a/intent_brokering/examples/applications/simulated-camera/src/camera.rs b/intent_brokering/examples/applications/simulated-camera/src/camera.rs index cd6fdaac..68d1c35c 100644 --- a/intent_brokering/examples/applications/simulated-camera/src/camera.rs +++ b/intent_brokering/examples/applications/simulated-camera/src/camera.rs @@ -4,7 +4,7 @@ use async_stream::try_stream; use core::panic; -use examples_common::chariott::value::Value; +use examples_common::intent_brokering::value::Value; use intent_brokering_common::error::Error; use std::collections::HashMap; use std::path::PathBuf; diff --git a/intent_brokering/examples/applications/simulated-camera/src/intent_provider.rs b/intent_brokering/examples/applications/simulated-camera/src/intent_provider.rs index 053e194c..8937e46e 100644 --- a/intent_brokering/examples/applications/simulated-camera/src/intent_provider.rs +++ b/intent_brokering/examples/applications/simulated-camera/src/intent_provider.rs @@ -16,16 +16,16 @@ use intent_brokering_proto::{ use tonic::{Request, Response, Status}; use url::Url; -use examples_common::chariott::{ +use examples_common::intent_brokering::{ self, inspection::{fulfill, Entry}, streaming::ProtoExt as _, value::Value, }; -pub type StreamingStore = chariott::streaming::StreamingStore; +pub type StreamingStore = intent_brokering::streaming::StreamingStore; -const SCHEMA_VERSION_STREAMING: &str = "chariott.streaming.v1"; +const SCHEMA_VERSION_STREAMING: &str = "intent_brokering.streaming.v1"; const SCHEMA_REFERENCE: &str = "grpc+proto"; pub struct IntentProvider { diff --git a/intent_brokering/examples/applications/simulated-camera/src/main.rs b/intent_brokering/examples/applications/simulated-camera/src/main.rs index 57e09848..da118bed 100644 --- a/intent_brokering/examples/applications/simulated-camera/src/main.rs +++ b/intent_brokering/examples/applications/simulated-camera/src/main.rs @@ -6,16 +6,16 @@ mod camera; mod communication; mod intent_provider; -use examples_common::chariott; +use examples_common::intent_brokering; use intent_brokering_common::error::Error; use intent_brokering_proto::runtime::{ intent_registration::Intent, intent_service_registration::ExecutionLocality, }; -chariott::provider::main!(wain); +intent_brokering::provider::main!(wain); async fn wain() -> Result<(), Error> { - let (url, socket_address) = chariott::provider::register( + let (url, socket_address) = intent_brokering::provider::register( "sdv.cabin.camera", "0.0.1", "sdv.camera.simulated", diff --git a/intent_brokering/examples/common/src/examples/detection.rs b/intent_brokering/examples/common/src/examples/detection.rs index a5798fff..fafa88a3 100644 --- a/intent_brokering/examples/common/src/examples/detection.rs +++ b/intent_brokering/examples/common/src/examples/detection.rs @@ -6,7 +6,7 @@ use intent_brokering_common::error::{Error, ResultExt}; use intent_brokering_proto::common::{Blob, InvokeFulfillment, InvokeIntent}; use prost::Message; -use crate::chariott::value::Value; +use crate::intent_brokering::value::Value; use super::proto::detection::{ DetectEntry, DetectRequest as DetectRequestMessage, DetectResponse as DetectResponseMessage, diff --git a/intent_brokering/examples/common/src/examples/mod.rs b/intent_brokering/examples/common/src/examples/mod.rs index 81ece431..ae16d1a6 100644 --- a/intent_brokering/examples/common/src/examples/mod.rs +++ b/intent_brokering/examples/common/src/examples/mod.rs @@ -2,7 +2,7 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -/// Modules in `examples` are not common to Chariott in general, but common to +/// Modules in `examples` are not common to IntentBrokering in general, but common to /// one of our examples. The sub-modules illustrate how shared code between /// similar examples can look like. pub mod detection; diff --git a/intent_brokering/examples/common/src/chariott/api.rs b/intent_brokering/examples/common/src/intent_brokering/api.rs similarity index 90% rename from intent_brokering/examples/common/src/chariott/api.rs rename to intent_brokering/examples/common/src/intent_brokering/api.rs index 2ab7aa13..99095030 100644 --- a/intent_brokering/examples/common/src/chariott/api.rs +++ b/intent_brokering/examples/common/src/intent_brokering/api.rs @@ -3,8 +3,8 @@ // SPDX-License-Identifier: MIT // api.rs contains code that can be considered "boilerplate" when -// interacting with the Chariott runtime. It will most likely need to be -// repeated for all applications interacting with Chariott. +// interacting with the Intent Brokering runtime. It will most likely need to be +// repeated for all applications interacting with Intent Brokering. use std::{ collections::HashMap, @@ -33,8 +33,8 @@ use intent_brokering_proto::{ use tonic::{transport::Channel, Request, Response}; use tracing::debug; -const CHARIOTT_URL_KEY: &str = "CHARIOTT_URL"; -const DEFAULT_CHARIOTT_URL: &str = env!("DEFAULT_CHARIOTT_URL"); +const INTENT_BROKER_URL_KEY: &str = "INTENT_BROKER_URL"; +const DEFAULT_INTENT_BROKER_URL: &str = env!("DEFAULT_INTENT_BROKER_URL"); struct Fulfillment(FulfillmentEnum); @@ -82,24 +82,24 @@ impl_try_from_var!(Fulfillment, FulfillmentEnum::Subscribe, SubscribeFulfillment impl_try_from_var!(Fulfillment, FulfillmentEnum::Discover, DiscoverFulfillment); #[derive(Clone)] -pub struct GrpcChariott { +pub struct GrpcIntentBrokering { client: IntentBrokeringServiceClient, } -impl GrpcChariott { +impl GrpcIntentBrokering { pub async fn connect() -> Result { - let chariott_url = - env::var(CHARIOTT_URL_KEY).unwrap_or_else(|_| DEFAULT_CHARIOTT_URL.to_string()); - let client = IntentBrokeringServiceClient::connect(chariott_url) + let intent_brokering_url = + env::var(INTENT_BROKER_URL_KEY).unwrap_or_else(|_| DEFAULT_INTENT_BROKER_URL.to_string()); + let client = IntentBrokeringServiceClient::connect(intent_brokering_url) .await - .map_err_with("Connecting to Chariott failed.")?; + .map_err_with("Connecting to IntentBrokering failed.")?; Ok(Self { client }) } } #[async_trait] -impl ChariottCommunication for GrpcChariott { +impl IntentBrokeringCommunication for GrpcIntentBrokering { async fn fulfill( &mut self, namespace: impl Into> + Send, @@ -115,10 +115,10 @@ impl ChariottCommunication for GrpcChariott { } } -/// Chariott abstracts the Communication layer, but is based on the Protobuf -/// definitions of the Chariott API. +/// IntentBrokering abstracts the Communication layer, but is based on the Protobuf +/// definitions of the IntentBrokering API. #[async_trait] -pub trait ChariottCommunication: Send { +pub trait IntentBrokeringCommunication: Send { async fn fulfill( &mut self, namespace: impl Into> + Send, @@ -126,9 +126,9 @@ pub trait ChariottCommunication: Send { ) -> Result, Error>; } -/// Chariott abstracts the Protobuf definitions that define Chariott's API. +/// IntentBrokering abstracts the Protobuf definitions that define IntentBrokering's API. #[async_trait] -pub trait Chariott: Send { +pub trait IntentBrokering: Send { async fn invoke + Send>( &mut self, namespace: impl Into> + Send, @@ -169,7 +169,7 @@ pub trait Chariott: Send { } #[async_trait] -impl Chariott for T { +impl IntentBrokering for T { async fn invoke + Send>( &mut self, namespace: impl Into> + Send, @@ -300,7 +300,7 @@ impl Chariott for T { } #[async_trait::async_trait] -pub trait ChariottExt { +pub trait IntentBrokeringExt { async fn listen<'b>( self, namespace: impl Into> + Send, @@ -309,9 +309,9 @@ pub trait ChariottExt { } #[async_trait::async_trait] -impl ChariottExt for &mut T +impl IntentBrokeringExt for &mut T where - T: Chariott + Send, + T: IntentBrokering + Send, { async fn listen<'b>( self, @@ -319,7 +319,7 @@ where subscription_sources: impl IntoIterator> + Send, ) -> Result>, Error> { const CHANNEL_ID_HEADER_NAME: &str = "x-chariott-channel-id"; - const SDV_EVENT_STREAMING_SCHEMA_REFERENCE: &str = "chariott.streaming.v1"; + const SDV_EVENT_STREAMING_SCHEMA_REFERENCE: &str = "intent_brokering.streaming.v1"; const SDV_EVENT_STREAMING_SCHEMA_KIND: &str = "grpc+proto"; let namespace = namespace.into(); diff --git a/intent_brokering/examples/common/src/chariott/inspection.rs b/intent_brokering/examples/common/src/intent_brokering/inspection.rs similarity index 100% rename from intent_brokering/examples/common/src/chariott/inspection.rs rename to intent_brokering/examples/common/src/intent_brokering/inspection.rs diff --git a/intent_brokering/examples/common/src/chariott/mod.rs b/intent_brokering/examples/common/src/intent_brokering/mod.rs similarity index 100% rename from intent_brokering/examples/common/src/chariott/mod.rs rename to intent_brokering/examples/common/src/intent_brokering/mod.rs diff --git a/intent_brokering/examples/common/src/chariott/provider.rs b/intent_brokering/examples/common/src/intent_brokering/provider.rs similarity index 97% rename from intent_brokering/examples/common/src/chariott/provider.rs rename to intent_brokering/examples/common/src/intent_brokering/provider.rs index 768a8b2a..f07d7fb1 100644 --- a/intent_brokering/examples/common/src/chariott/provider.rs +++ b/intent_brokering/examples/common/src/intent_brokering/provider.rs @@ -8,7 +8,7 @@ macro_rules! intent_provider_main { #[cfg(not(tarpaulin_include))] #[::tokio::main] async fn main() -> ::std::process::ExitCode { - use ::examples_common::chariott::provider::internal::trace_result; + use ::examples_common::intent_brokering::provider::internal::trace_result; use ::std::process::ExitCode; use ::tracing_subscriber::{util::SubscriberInitExt, EnvFilter}; diff --git a/intent_brokering/examples/common/src/chariott/registration.rs b/intent_brokering/examples/common/src/intent_brokering/registration.rs similarity index 81% rename from intent_brokering/examples/common/src/chariott/registration.rs rename to intent_brokering/examples/common/src/intent_brokering/registration.rs index ccbffd80..0a55c119 100644 --- a/intent_brokering/examples/common/src/chariott/registration.rs +++ b/intent_brokering/examples/common/src/intent_brokering/registration.rs @@ -20,8 +20,8 @@ use url::Url; use crate::url::UrlExt as _; -const CHARIOTT_URL_KEY: &str = "CHARIOTT_URL"; -const DEFAULT_CHARIOTT_URL: &str = env!("DEFAULT_CHARIOTT_URL"); +const INTENT_BROKER_URL_KEY: &str = "INTENT_BROKER_URL"; +const DEFAULT_INTENT_BROKER_URL: &str = env!("DEFAULT_INTENT_BROKER_URL"); const ANNOUNCE_URL_KEY: &str = "ANNOUNCE_URL"; pub enum ConfigSource<'a, T> { @@ -36,7 +36,7 @@ pub struct Builder { provider_url: Url, namespace: Box, intents: Vec, - chariott_url: Url, + intent_broker_url: Url, registration_interval: Duration, locality: ExecutionLocality, } @@ -50,8 +50,8 @@ impl Builder { intents: impl IntoIterator, locality: ExecutionLocality, ) -> Self { - let chariott_url = env::var(CHARIOTT_URL_KEY) - .unwrap_or_else(|_| DEFAULT_CHARIOTT_URL.to_string()) + let intent_broker_url = env::var(INTENT_BROKER_URL_KEY) + .unwrap_or_else(|_| DEFAULT_INTENT_BROKER_URL.to_string()) .parse() .unwrap(); @@ -65,7 +65,7 @@ impl Builder { provider_url: url, namespace: namespace.into(), intents: intents.into_iter().collect(), - chariott_url, + intent_broker_url, registration_interval: Duration::from_secs(5), locality, } @@ -75,7 +75,7 @@ impl Builder { match value { ConfigSource::Value(value) => self.registration_interval = value, ConfigSource::Environment(name) => { - let name = name.unwrap_or("CHARIOTT_REGISTRATION_INTERVAL"); + let name = name.unwrap_or("INTENT_BROKER_REGISTRATION_INTERVAL"); let registration_interval = self.registration_interval; return self.set_registration_interval(ConfigSource::Value( config::env::(name) @@ -87,13 +87,13 @@ impl Builder { self } - pub fn set_chariott_url(mut self, value: ConfigSource) -> Self { + pub fn set_intent_broker_url(mut self, value: ConfigSource) -> Self { match value { - ConfigSource::Value(value) => self.chariott_url = value, + ConfigSource::Value(value) => self.intent_broker_url = value, ConfigSource::Environment(name) => { - let name = name.unwrap_or("CHARIOTT_URL"); + let name = name.unwrap_or("INTENT_BROKER_URL"); if let Some(url) = config::env::(name) { - return self.set_chariott_url(ConfigSource::Value(url)); + return self.set_intent_broker_url(ConfigSource::Value(url)); } } } @@ -101,7 +101,7 @@ impl Builder { } pub fn from_env(self) -> Self { - self.set_chariott_url(ConfigSource::Environment(None)) + self.set_intent_broker_url(ConfigSource::Environment(None)) .set_registration_interval(ConfigSource::Environment(None)) } @@ -148,11 +148,11 @@ impl Builder { ) -> Result<(), Error> { if client.is_none() { *client = Some( - IntentBrokeringServiceClient::connect(self.chariott_url.to_string()) + IntentBrokeringServiceClient::connect(self.intent_broker_url.to_string()) .await .map_err_with(format!( - "Could not connect to Chariott ({})", - self.chariott_url + "Could not connect to IntentBrokering ({})", + self.intent_broker_url ))?, ); } @@ -170,7 +170,7 @@ impl Builder { let registration_state = client .announce(announce_request.clone()) .await - .map_err_with("Error when announcing to Chariott.")? + .map_err_with("Error when announcing to IntentBrokering.")? .into_inner() .registration_state; @@ -187,11 +187,11 @@ impl Builder { .collect(), }; - tracing::info!("Registered with Chariott runtime: {:?}", register_request); + tracing::info!("Registered with IntentBrokering runtime: {:?}", register_request); _ = client .register(register_request.clone()) .await - .map_err_with("Error when registering with Chariott.")?; + .map_err_with("Error when registering with IntentBrokering.")?; } } diff --git a/intent_brokering/examples/common/src/chariott/streaming.rs b/intent_brokering/examples/common/src/intent_brokering/streaming.rs similarity index 96% rename from intent_brokering/examples/common/src/chariott/streaming.rs rename to intent_brokering/examples/common/src/intent_brokering/streaming.rs index e2141c76..672841af 100644 --- a/intent_brokering/examples/common/src/chariott/streaming.rs +++ b/intent_brokering/examples/common/src/intent_brokering/streaming.rs @@ -24,7 +24,7 @@ impl Observer for InternalStreamingEss } /// Represents an in-memory store that contains a blanket implementation for -/// integration with the Chariott streaming API. It generalizes over any type of +/// integration with the IntentBrokering streaming API. It generalizes over any type of /// value to be published, as long as that value can be transformed into a value /// which is compatible with the Proto contract. pub struct StreamingStore { diff --git a/intent_brokering/examples/common/src/chariott/value.rs b/intent_brokering/examples/common/src/intent_brokering/value.rs similarity index 100% rename from intent_brokering/examples/common/src/chariott/value.rs rename to intent_brokering/examples/common/src/intent_brokering/value.rs diff --git a/intent_brokering/examples/common/src/lib.rs b/intent_brokering/examples/common/src/lib.rs index f00e9aca..6dc79af2 100644 --- a/intent_brokering/examples/common/src/lib.rs +++ b/intent_brokering/examples/common/src/lib.rs @@ -2,6 +2,6 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -pub mod chariott; +pub mod intent_brokering; pub mod examples; pub mod url; diff --git a/intent_brokering/proto/intent_brokering/common/v1/common.proto b/intent_brokering/proto/intent_brokering/common/v1/common.proto index 7aa100be..818e9e6c 100644 --- a/intent_brokering/proto/intent_brokering/common/v1/common.proto +++ b/intent_brokering/proto/intent_brokering/common/v1/common.proto @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT /** -* Common Messages for the Chariott runtime. +* Common Messages for the IntentBrokering runtime. * * The protobuf definitions for messages common to the other definitions. */ @@ -46,7 +46,7 @@ message WriteFulfillment { /** Subscribe to a source on the application. This requires an already open streaming channel. * The `channel_id` is used to identify the channel to use for subscription. This is provided * by the provider as a gRPC metadata header when establishing a channel through the streaming -* interface call. See [chariott.streaming.v1.proto](chariott.streaming.v1.proto) for more details. +* interface call. See [intent_brokering.streaming.v1.proto](intent_brokering.streaming.v1.proto) for more details. */ message SubscribeIntent { string channel_id = 1; @@ -113,7 +113,7 @@ message InspectFulfillment { /** * Invoke Intent * -* The invoke intent is used to invoke a method on the application through the chariott runtime. +* The invoke intent is used to invoke a method on the application through the intent brokering runtime. */ message InvokeIntent { string command = 1; diff --git a/intent_brokering/src/execution.rs b/intent_brokering/src/execution.rs index 480017ef..63a6a94a 100644 --- a/intent_brokering/src/execution.rs +++ b/intent_brokering/src/execution.rs @@ -116,7 +116,7 @@ where } } RuntimeBinding::SystemDiscover(url) => { - const SCHEMA_VERSION_STREAMING: &str = "chariott.streaming.v1"; + const SCHEMA_VERSION_STREAMING: &str = "intent_brokering.streaming.v1"; const SCHEMA_REFERENCE: &str = "grpc+proto"; fulfill_response(FulfillmentEnum::Discover(DiscoverFulfillment { @@ -364,7 +364,7 @@ pub(crate) mod tests { services: vec![Service { url: url.to_string(), schema_kind: "grpc+proto".to_owned(), - schema_reference: "chariott.streaming.v1".to_owned(), + schema_reference: "intent_brokering.streaming.v1".to_owned(), metadata: HashMap::new(), }], })), diff --git a/intent_brokering/src/chariott_grpc.rs b/intent_brokering/src/intent_brokering_grpc.rs similarity index 100% rename from intent_brokering/src/chariott_grpc.rs rename to intent_brokering/src/intent_brokering_grpc.rs diff --git a/intent_brokering/src/lib.rs b/intent_brokering/src/lib.rs index 71fc8d22..76daf7a6 100644 --- a/intent_brokering/src/lib.rs +++ b/intent_brokering/src/lib.rs @@ -2,7 +2,7 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -pub mod chariott_grpc; +pub mod intent_brokering_grpc; mod connection_provider; mod execution; mod intent_broker; diff --git a/intent_brokering/src/main.rs b/intent_brokering/src/main.rs index 0c7457f2..24bc74a2 100644 --- a/intent_brokering/src/main.rs +++ b/intent_brokering/src/main.rs @@ -2,7 +2,7 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT -use intent_brokering::chariott_grpc::IntentBrokeringServer; +use intent_brokering::intent_brokering_grpc::IntentBrokeringServer; use intent_brokering::registry::{self, Registry}; use intent_brokering::streaming::StreamingEss; use intent_brokering::IntentBroker; @@ -53,7 +53,7 @@ async fn main() -> Result<(), Box> { streaming_ess.clone(), ); - let registry_config = try_env::("CHARIOTT_REGISTRY_TTL_SECS") + let registry_config = try_env::("INTENT_BROKERING_REGISTRY_TTL_SECS") .ok()? .map(Duration::from_secs) .map(|v| registry::Config::default().set_entry_ttl_bounded(v)) @@ -71,7 +71,7 @@ async fn main() -> Result<(), Box> { tracing::info!("starting grpc services"); let addr = format!("0.0.0.0:{PORT}").parse().unwrap(); - tracing::info!("chariott listening on {addr}"); + tracing::info!("intent broker listening on {addr}"); let server = Arc::new(IntentBrokeringServer::new(registry, broker)); let router = Server::builder() diff --git a/intent_brokering/tests/README.md b/intent_brokering/tests/README.md index 061941e4..bc5def89 100644 --- a/intent_brokering/tests/README.md +++ b/intent_brokering/tests/README.md @@ -10,7 +10,7 @@ To run the tests, you can either use the CI, or run the tests locally. Assuming the current working directory is the project root, run: ```sh -cargo build --release -p chariott -p kv-app +cargo build --release -p intent-brokering -p kv-app CHARIOTT_REGISTRY_TTL_SECS=7 ./target/release/chariott & ./target/release/kv-app & CHARIOTT_REGISTRY_TTL_SECS=7 cargo test --test '*e2e' diff --git a/intent_brokering/tests/chariott_integration.rs b/intent_brokering/tests/chariott_integration.rs index 69346b0a..5070e1d2 100644 --- a/intent_brokering/tests/chariott_integration.rs +++ b/intent_brokering/tests/chariott_integration.rs @@ -7,15 +7,15 @@ use std::time::Instant; use async_trait::async_trait; use common::get_uuid; -use examples_common::chariott::{ - api::{Chariott, ChariottCommunication}, +use examples_common::intent_brokering::{ + api::{IntentBrokering, IntentBrokeringCommunication}, value::Value, }; use intent_brokering::registry::{ ExecutionLocality, IntentConfiguration, IntentKind, ServiceConfiguration, ServiceId, }; use intent_brokering::streaming::StreamingEss; -use intent_brokering::{chariott_grpc::IntentBrokeringServer, registry::Registry, IntentBroker}; +use intent_brokering::{intent_brokering_grpc::IntentBrokeringServer, registry::Registry, IntentBroker}; use intent_brokering_common::error::{Error, ResultExt as _}; use intent_brokering_common::shutdown::RouterExt as _; use intent_brokering_proto::{ @@ -185,7 +185,7 @@ async fn setup_multiple(providers: impl IntoIterator) -> S } #[async_trait] -impl ChariottCommunication for Subject { +impl IntentBrokeringCommunication for Subject { async fn fulfill( &mut self, namespace: impl Into> + Send, diff --git a/intent_brokering/tests/container-e2e-tests-wsl2.sh b/intent_brokering/tests/container-e2e-tests-wsl2.sh index b025e4e1..031b3ef4 100755 --- a/intent_brokering/tests/container-e2e-tests-wsl2.sh +++ b/intent_brokering/tests/container-e2e-tests-wsl2.sh @@ -12,7 +12,7 @@ set -e # set up error handler to clean up docker containers and network function cleanup { echo "Cleaning up containers and network" - docker rm -f chariott 2>/dev/null + docker rm -f intent_brokering 2>/dev/null docker rm -f kv-app 2>/dev/null } @@ -35,13 +35,13 @@ if cleanup; then echo "Cleaned up existing containers and network" fi -# build chariott docker container -docker build --tag "chariott:$TAG" --file "$DOCKERFILE_CONTEXT/Dockerfile" "$DOCKERFILE_CONTEXT" -docker run --init --rm --name chariott --detach --publish 4243:4243 "chariott:$TAG" +# build intent_brokering docker container +docker build --tag "intent_brokering:$TAG" --file "$DOCKERFILE_CONTEXT/Dockerfile" "$DOCKERFILE_CONTEXT" +docker run --init --rm --name intent_brokering --detach --publish 4243:4243 "intent_brokering:$TAG" # build kv-app docker container docker build --tag "kv-app:$TAG" --file "$DOCKERFILE_CONTEXT/examples/applications/Dockerfile.kv-app.ci" --build-arg APP_NAME=kv-app "$DOCKERFILE_CONTEXT" -docker run --init --rm --name kv-app --detach --publish 50064:50064 --env ANNOUNCE_URL=http://host.docker.internal:50064 --env CHARIOTT_URL=http://host.docker.internal:4243 "kv-app:$TAG" # DevSkim: ignore DS137138 +docker run --init --rm --name kv-app --detach --publish 50064:50064 --env ANNOUNCE_URL=http://host.docker.internal:50064 --env INTENT_BROKER_URL=http://host.docker.internal:4243 "kv-app:$TAG" # DevSkim: ignore DS137138 # run the end to end tests cargo test --test "*e2e" diff --git a/intent_brokering/tests/provider.rs b/intent_brokering/tests/provider.rs index 8c11fd7c..db82e839 100644 --- a/intent_brokering/tests/provider.rs +++ b/intent_brokering/tests/provider.rs @@ -5,7 +5,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use async_trait::async_trait; -use examples_common::chariott::value::Value; +use examples_common::intent_brokering::value::Value; use intent_brokering_proto::{ common::{FulfillmentEnum, FulfillmentMessage, IntentEnum, InvokeFulfillment, InvokeIntent}, provider::{ diff --git a/intent_brokering/tests/registry-e2e.rs b/intent_brokering/tests/registry-e2e.rs index 60b43c9a..e1b3df42 100644 --- a/intent_brokering/tests/registry-e2e.rs +++ b/intent_brokering/tests/registry-e2e.rs @@ -5,8 +5,8 @@ use std::time::Duration; use common::get_uuid; -use examples_common::chariott::{ - api::{Chariott, ChariottExt as _, GrpcChariott}, +use examples_common::intent_brokering::{ + api::{IntentBrokering, IntentBrokeringExt as _, GrpcIntentBrokering}, registration::Builder as RegistrationBuilder, }; use intent_brokering_proto::runtime::{ @@ -31,15 +31,15 @@ async fn expired_registrations_are_pruned_after_ttl() -> Result<(), anyhow::Erro ExecutionLocality::Local, ); - let mut chariott = setup().await; + let mut intent_broker = setup().await; // act builder.register_once(&mut None, true).await?; - let initial_entries = chariott.inspect("system.registry", namespace.clone()).await?; - let ttl = Duration::from_secs(env!("CHARIOTT_REGISTRY_TTL_SECS").parse::().unwrap() + 1); + let initial_entries = intent_broker.inspect("system.registry", namespace.clone()).await?; + let ttl = Duration::from_secs(env!("INTENT_BROKERING_REGISTRY_TTL_SECS").parse::().unwrap() + 1); sleep(ttl).await; - let entries = chariott.inspect("system.registry", namespace).await?; + let entries = intent_broker.inspect("system.registry", namespace).await?; // assert assert_eq!(1, initial_entries.len()); @@ -82,6 +82,6 @@ async fn when_provider_registers_notifies_registry_observers() -> anyhow::Result Ok(()) } -async fn setup() -> impl Chariott { - GrpcChariott::connect().await.unwrap() +async fn setup() -> impl IntentBrokering { + GrpcIntentBrokering::connect().await.unwrap() } diff --git a/intent_brokering/tests/store-e2e.rs b/intent_brokering/tests/store-e2e.rs index 67e4b928..31d56cb4 100644 --- a/intent_brokering/tests/store-e2e.rs +++ b/intent_brokering/tests/store-e2e.rs @@ -5,8 +5,8 @@ use std::{collections::HashSet, error::Error as _, time::Duration}; use common::get_uuid; -use examples_common::chariott::{ - api::{Chariott, ChariottExt, Event, GrpcChariott}, +use examples_common::intent_brokering::{ + api::{IntentBrokering, IntentBrokeringExt, Event, GrpcIntentBrokering}, value::Value, }; use intent_brokering_common::error::Error; @@ -20,10 +20,10 @@ const KV_NAMESPACE: &str = "sdv.kvs"; #[tokio::test] async fn when_key_does_not_exist_returns_none() -> Result<(), anyhow::Error> { // arrange - let mut chariott = setup().await; + let mut intent_broker = setup().await; // act - let response = chariott.read(KV_NAMESPACE, get_uuid()).await?; + let response = intent_broker.read(KV_NAMESPACE, get_uuid()).await?; // assert assert_eq!(None, response); @@ -34,13 +34,13 @@ async fn when_key_does_not_exist_returns_none() -> Result<(), anyhow::Error> { #[tokio::test] async fn when_writing_value_returns_value_on_read() -> Result<(), anyhow::Error> { // arrange - let mut chariott = setup().await; + let mut intent_broker = setup().await; let value: Value = "some_value".into(); let key = get_uuid(); // act - chariott.write(KV_NAMESPACE, key.clone(), value.clone()).await?; - let response = chariott.read(KV_NAMESPACE, key).await?; + intent_broker.write(KV_NAMESPACE, key.clone(), value.clone()).await?; + let response = intent_broker.read(KV_NAMESPACE, key).await?; // assert assert_eq!(Some(value), response); @@ -51,10 +51,10 @@ async fn when_writing_value_returns_value_on_read() -> Result<(), anyhow::Error> #[tokio::test] async fn when_provider_does_not_exist_returns_error() { // arrange - let mut chariott = setup().await; + let mut intent_broker = setup().await; // act - let response = chariott.read("sdv.does_not_exist", "key").await; + let response = intent_broker.read("sdv.does_not_exist", "key").await; // assert assert!(response.unwrap_err().source().unwrap().to_string().contains("No provider found.")); @@ -63,13 +63,13 @@ async fn when_provider_does_not_exist_returns_error() { #[tokio::test] async fn when_writing_while_streaming_publishes_value() -> Result<(), anyhow::Error> { // arrange - let mut chariott = setup().await; + let mut intent_broker = setup().await; let key = get_uuid(); let value: Value = 10.into(); // act - let response_stream = chariott.listen(KV_NAMESPACE, [key.clone()]).await?; - chariott.write(KV_NAMESPACE, key.clone(), value.clone()).await?; + let response_stream = intent_broker.listen(KV_NAMESPACE, [key.clone()]).await?; + intent_broker.write(KV_NAMESPACE, key.clone(), value.clone()).await?; // assert let event = response_stream.take(1).collect::>>().await; @@ -85,13 +85,13 @@ async fn when_writing_while_streaming_publishes_value() -> Result<(), anyhow::Er async fn when_streaming_increases_sequence_number() -> Result<(), anyhow::Error> { // arrange const NUMBER_OF_EVENTS: u64 = 5; - let mut chariott = setup().await; + let mut intent_broker = setup().await; let key = get_uuid(); // act - let response_stream = chariott.listen(KV_NAMESPACE, [key.clone()]).await?; + let response_stream = intent_broker.listen(KV_NAMESPACE, [key.clone()]).await?; for _ in 0..NUMBER_OF_EVENTS { - chariott.write(KV_NAMESPACE, key.clone(), 10.into()).await?; + intent_broker.write(KV_NAMESPACE, key.clone(), 10.into()).await?; } // assert @@ -114,11 +114,11 @@ async fn when_streaming_increases_sequence_number() -> Result<(), anyhow::Error> #[tokio::test] async fn when_writing_to_a_different_key_does_not_publish_value() -> Result<(), anyhow::Error> { // arrange - let mut chariott = setup().await; + let mut intent_broker = setup().await; // act - let mut response_stream = chariott.listen(KV_NAMESPACE, [get_uuid()]).await?; - chariott.write(KV_NAMESPACE, get_uuid(), 10.into()).await?; + let mut response_stream = intent_broker.listen(KV_NAMESPACE, [get_uuid()]).await?; + intent_broker.write(KV_NAMESPACE, get_uuid(), 10.into()).await?; // assert @@ -136,6 +136,6 @@ async fn when_writing_to_a_different_key_does_not_publish_value() -> Result<(), Ok(()) } -async fn setup() -> impl Chariott { - GrpcChariott::connect().await.unwrap() +async fn setup() -> impl IntentBrokering { + GrpcIntentBrokering::connect().await.unwrap() } diff --git a/intent_brokering/tools/charc b/intent_brokering/tools/charc index ce47b232..c4290494 100755 --- a/intent_brokering/tools/charc +++ b/intent_brokering/tools/charc @@ -37,7 +37,7 @@ EOF local ID; ID="$(date -u +%s.%N)" echo "$REQ" > "$GRPC_LOG_DIR_PATH/req-$ID" grpcurl -plaintext -import-path ../proto -proto ../proto/intent_brokering/runtime/v1/runtime.proto \ - -d @ "${CHARIOTT_ADDRESS:-0.0.0.0:4243}" \ + -d @ "${INTENT_BROKER_ADDRESS:-0.0.0.0:4243}" \ intent_brokering.runtime.v1.IntentBrokeringService/Fulfill <<< "$REQ" \ | tee "$GRPC_LOG_DIR_PATH/rsp-$ID" if [[ "${PIPESTATUS[*]}" != '0 0' ]]; then return 1; fi @@ -193,7 +193,7 @@ cmd_listen() { fi local ADDRESS; ADDRESS="$( cmd_discover \ - | jq -r '.[] | select(.schemaReference == "chariott.streaming.v1" and .schemaKind == "grpc+proto") | .url' \ + | jq -r '.[] | select(.schemaReference == "intent_brokering.streaming.v1" and .schemaKind == "grpc+proto") | .url' \ | tr -d / | sed -E "s/^http://" )" if [ -z "$ADDRESS" ]; then @@ -318,7 +318,7 @@ init_channel_context() { EVENTS_FILE_PATH="$CHAR_HOME/channel/$NAMESPACE/events" } -chariott_cmd() { +intent_brokering_cmd() { if [ -z "$2" ]; then echo>&2 'Missing namespace argument.' return 1 @@ -342,7 +342,7 @@ case "$1" in listen|\ channel|\ inspect) - chariott_cmd "$@" + intent_brokering_cmd "$@" ;; events) shift