From f3b11fdb6343bed7130d74b5963fcdc4028a9bde Mon Sep 17 00:00:00 2001 From: Ash Beitz <8304894+ashbeitz@users.noreply.github.com> Date: Fri, 3 May 2024 16:06:51 -0700 Subject: [PATCH] Digital Twin Graph --- Cargo.toml | 2 +- README.md | 2 +- .../digital_twin_graph/src/digital_twin_graph_impl.rs | 10 +++++----- samples/{graph => digital_twin_graph}/Cargo.toml | 2 +- .../{graph => digital_twin_graph}/consumer/src/main.rs | 0 .../seat_massager_provider/src/main.rs | 0 .../seat_massager_provider/src/request_impl.rs | 0 .../vehicle_core_provider/src/main.rs | 0 .../vehicle_core_provider/src/request_impl.rs | 0 9 files changed, 8 insertions(+), 8 deletions(-) rename samples/{graph => digital_twin_graph}/Cargo.toml (97%) rename samples/{graph => digital_twin_graph}/consumer/src/main.rs (100%) rename samples/{graph => digital_twin_graph}/seat_massager_provider/src/main.rs (100%) rename samples/{graph => digital_twin_graph}/seat_massager_provider/src/request_impl.rs (100%) rename samples/{graph => digital_twin_graph}/vehicle_core_provider/src/main.rs (100%) rename samples/{graph => digital_twin_graph}/vehicle_core_provider/src/request_impl.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 12cfeb2a..0634fc50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ members = [ "samples/common", "samples/protobuf_data_access", "samples/command", - "samples/graph", + "samples/digital_twin_graph", "samples/managed_subscribe", "samples/mixed", "samples/property", diff --git a/README.md b/README.md index 7df5c28c..e69546f4 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ IBEJI_HOME=/etc/ibeji ./invehicle-digital-twin The above example tells `invehicle-digital-twin` to load configuration files from `/etc/ibeji` instead of using the current working directory. -Chariott may be used to discover the in-vehicle digital twin service. We will discuss how to enable this feature. +Chariott may be used to discover the in-vehicle digital twin service. We will discuss how to enable this feature in the section on [Using Chariott](#using-chariott). ### Property Sample diff --git a/core/module/digital_twin_graph/src/digital_twin_graph_impl.rs b/core/module/digital_twin_graph/src/digital_twin_graph_impl.rs index 51e2a1a0..b6ddff4e 100644 --- a/core/module/digital_twin_graph/src/digital_twin_graph_impl.rs +++ b/core/module/digital_twin_graph/src/digital_twin_graph_impl.rs @@ -187,7 +187,7 @@ impl DigitalTwinGraph for DigitalTwinGraphImpl { .map_err(tonic::Status::internal)?; // Build a map of instance id to its associated endpoint infos. - let instance_provide_map: std::collections::HashMap> = + let instance_provider_map: std::collections::HashMap> = provider_endpoint_info_list .iter() .map(|provider_endpoint_info| { @@ -203,9 +203,9 @@ impl DigitalTwinGraph for DigitalTwinGraphImpl { let mut values = vec![]; - for instance_id in instance_provide_map.keys() { + for instance_id in instance_provider_map.keys() { // We will only use the first provider. For a high availability scenario, we can try multiple providers. - let provider_endpoint_info = &instance_provide_map[instance_id][0]; + let provider_endpoint_info = &instance_provider_map[instance_id][0]; let provider_uri = provider_endpoint_info.uri.clone(); let instance_id = provider_endpoint_info.context.clone(); @@ -317,7 +317,7 @@ impl DigitalTwinGraph for DigitalTwinGraphImpl { .map_err(tonic::Status::internal)?; if provider_endpoint_info_list.is_empty() { - return Err(tonic::Status::internal("No providers found")); + return Err(tonic::Status::not_found("No providers found")); } // We will only use the first provider. @@ -438,7 +438,7 @@ impl DigitalTwinGraph for DigitalTwinGraphImpl { .map_err(tonic::Status::internal)?; if provider_endpoint_info_list.is_empty() { - return Err(tonic::Status::internal("No providers found")); + return Err(tonic::Status::not_found("No providers found")); } // We will only use the first provider. diff --git a/samples/graph/Cargo.toml b/samples/digital_twin_graph/Cargo.toml similarity index 97% rename from samples/graph/Cargo.toml rename to samples/digital_twin_graph/Cargo.toml index a875b559..c1b13245 100644 --- a/samples/graph/Cargo.toml +++ b/samples/digital_twin_graph/Cargo.toml @@ -3,7 +3,7 @@ # SPDX-License-Identifier: MIT [package] -name = "samples-graph" +name = "samples-digital-twin-graph" version = "0.1.0" edition = "2021" license = "MIT" diff --git a/samples/graph/consumer/src/main.rs b/samples/digital_twin_graph/consumer/src/main.rs similarity index 100% rename from samples/graph/consumer/src/main.rs rename to samples/digital_twin_graph/consumer/src/main.rs diff --git a/samples/graph/seat_massager_provider/src/main.rs b/samples/digital_twin_graph/seat_massager_provider/src/main.rs similarity index 100% rename from samples/graph/seat_massager_provider/src/main.rs rename to samples/digital_twin_graph/seat_massager_provider/src/main.rs diff --git a/samples/graph/seat_massager_provider/src/request_impl.rs b/samples/digital_twin_graph/seat_massager_provider/src/request_impl.rs similarity index 100% rename from samples/graph/seat_massager_provider/src/request_impl.rs rename to samples/digital_twin_graph/seat_massager_provider/src/request_impl.rs diff --git a/samples/graph/vehicle_core_provider/src/main.rs b/samples/digital_twin_graph/vehicle_core_provider/src/main.rs similarity index 100% rename from samples/graph/vehicle_core_provider/src/main.rs rename to samples/digital_twin_graph/vehicle_core_provider/src/main.rs diff --git a/samples/graph/vehicle_core_provider/src/request_impl.rs b/samples/digital_twin_graph/vehicle_core_provider/src/request_impl.rs similarity index 100% rename from samples/graph/vehicle_core_provider/src/request_impl.rs rename to samples/digital_twin_graph/vehicle_core_provider/src/request_impl.rs