From 6f4547bd877bc365fdb1cd8ad2d53685af63f777 Mon Sep 17 00:00:00 2001 From: William Lyles <26171886+wilyle@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:09:50 -0800 Subject: [PATCH] Merge contracts and common crates (#105) Merge contracts and common crates to simplify directory structure. This also helps deal with a circular dependency that arose in finishing #18 --- Cargo.lock | 31 +++---------------- Cargo.toml | 1 - .../in_memory_mock_cloud_adapter/Cargo.toml | 2 +- .../src/in_memory_mock_cloud_adapter.rs | 2 +- common/Cargo.toml | 5 ++- {contracts => common}/src/cloud_adapter.rs | 0 {contracts => common}/src/conversion.rs | 4 +-- .../src/digital_twin_adapter.rs | 0 .../src/digital_twin_map_entry.rs | 0 {contracts => common}/src/entity.rs | 0 common/src/lib.rs | 9 ++++++ {contracts => common}/src/mapping_client.rs | 0 {contracts => common}/src/provider_proxy.rs | 0 .../src/provider_proxy_selector.rs | 0 {contracts => common}/src/signal.rs | 0 common/src/signal_store.rs | 4 +-- contracts/Cargo.toml | 17 ---------- contracts/src/lib.rs | 13 -------- .../Cargo.toml | 1 - .../src/config.rs | 2 +- .../in_memory_mock_digital_twin_adapter.rs | 6 ++-- .../mock_digital_twin_adapter/Cargo.toml | 1 - .../src/mock_digital_twin_adapter.rs | 4 +-- freyja/Cargo.toml | 1 - freyja/src/cartographer.rs | 4 +-- freyja/src/emitter.rs | 4 +-- freyja/src/lib.rs | 8 ++--- .../in_memory_mock_mapping_client/Cargo.toml | 1 - .../src/config.rs | 2 +- .../src/in_memory_mock_mapping_client.rs | 4 +-- .../mock_mapping_service_client/Cargo.toml | 1 - .../src/mock_mapping_service_client.rs | 2 +- mocks/mock_digital_twin/Cargo.toml | 1 - mocks/mock_digital_twin/src/config.rs | 2 +- mocks/mock_digital_twin/src/main.rs | 2 +- mocks/mock_mapping_service/Cargo.toml | 1 - mocks/mock_mapping_service/src/config.rs | 2 +- mocks/mock_mapping_service/src/main.rs | 6 ++-- provider_proxies/grpc/v1/Cargo.toml | 1 - .../grpc/v1/src/grpc_client_impl.rs | 2 +- .../grpc/v1/src/grpc_provider_proxy.rs | 2 +- .../v1/src/grpc_provider_proxy_factory.rs | 2 +- .../http_mock_provider_proxy/Cargo.toml | 1 - .../src/http_mock_provider_proxy.rs | 6 ++-- .../src/http_mock_provider_proxy_factory.rs | 2 +- .../in_memory_mock_provider_proxy/Cargo.toml | 1 - .../src/in_memory_mock_provider_proxy.rs | 2 +- .../in_memory_mock_provider_proxy_factory.rs | 2 +- provider_proxies/managed_subscribe/Cargo.toml | 1 - .../src/managed_subscribe_provider_proxy.rs | 2 +- ...anaged_subscribe_provider_proxy_factory.rs | 2 +- provider_proxies/mqtt/Cargo.toml | 1 - .../mqtt/src/mqtt_provider_proxy.rs | 2 +- .../mqtt/src/mqtt_provider_proxy_factory.rs | 2 +- provider_proxy_selector/Cargo.toml | 2 +- .../src/provider_proxy_selector_impl.rs | 4 +-- 56 files changed, 64 insertions(+), 116 deletions(-) rename {contracts => common}/src/cloud_adapter.rs (100%) rename {contracts => common}/src/conversion.rs (97%) rename {contracts => common}/src/digital_twin_adapter.rs (100%) rename {contracts => common}/src/digital_twin_map_entry.rs (100%) rename {contracts => common}/src/entity.rs (100%) rename {contracts => common}/src/mapping_client.rs (100%) rename {contracts => common}/src/provider_proxy.rs (100%) rename {contracts => common}/src/provider_proxy_selector.rs (100%) rename {contracts => common}/src/signal.rs (100%) delete mode 100644 contracts/Cargo.toml delete mode 100644 contracts/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 3007df97..0d9c1813 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -528,7 +528,6 @@ dependencies = [ "crossbeam", "env_logger", "freyja-common", - "freyja-contracts", "grpc-provider-proxy-v1", "http-mock-provider-proxy", "in-memory-mock-cloud-adapter", @@ -555,26 +554,17 @@ version = "0.1.0" name = "freyja-common" version = "0.1.0" dependencies = [ + "async-trait", "config", - "freyja-contracts", + "crossbeam", "home", "log", "proc-macros", "serde", "serde_json", - "tokio", -] - -[[package]] -name = "freyja-contracts" -version = "0.1.0" -dependencies = [ - "async-trait", - "crossbeam", - "proc-macros", - "serde", "strum", "strum_macros", + "tokio", ] [[package]] @@ -707,7 +697,6 @@ dependencies = [ "crossbeam", "freyja-build-common", "freyja-common", - "freyja-contracts", "futures", "log", "samples-protobuf-data-access", @@ -805,7 +794,6 @@ dependencies = [ "crossbeam", "freyja-build-common", "freyja-common", - "freyja-contracts", "log", "reqwest", "serde", @@ -894,7 +882,7 @@ name = "in-memory-mock-cloud-adapter" version = "0.1.0" dependencies = [ "async-trait", - "freyja-contracts", + "freyja-common", "log", "serde_json", "time", @@ -908,7 +896,6 @@ dependencies = [ "async-trait", "freyja-build-common", "freyja-common", - "freyja-contracts", "serde", "tokio", ] @@ -920,7 +907,6 @@ dependencies = [ "async-trait", "freyja-build-common", "freyja-common", - "freyja-contracts", "serde", "tokio", ] @@ -933,7 +919,6 @@ dependencies = [ "crossbeam", "freyja-build-common", "freyja-common", - "freyja-contracts", "log", "serde", "tokio", @@ -1050,7 +1035,6 @@ dependencies = [ "crossbeam", "freyja-build-common", "freyja-common", - "freyja-contracts", "futures", "log", "paho-mqtt", @@ -1112,7 +1096,6 @@ dependencies = [ "env_logger", "freyja-build-common", "freyja-common", - "freyja-contracts", "http-mock-provider-proxy", "log", "reqwest", @@ -1127,7 +1110,6 @@ dependencies = [ "async-trait", "freyja-build-common", "freyja-common", - "freyja-contracts", "mock-digital-twin", "reqwest", "serde", @@ -1141,7 +1123,6 @@ dependencies = [ "env_logger", "freyja-build-common", "freyja-common", - "freyja-contracts", "log", "serde", "tokio", @@ -1154,7 +1135,6 @@ dependencies = [ "async-trait", "freyja-build-common", "freyja-common", - "freyja-contracts", "reqwest", "serde", ] @@ -1194,7 +1174,6 @@ dependencies = [ "crossbeam", "freyja-build-common", "freyja-common", - "freyja-contracts", "log", "paho-mqtt", "serde", @@ -1592,7 +1571,7 @@ version = "0.1.0" dependencies = [ "async-trait", "crossbeam", - "freyja-contracts", + "freyja-common", "grpc-provider-proxy-v1", "log", "tokio", diff --git a/Cargo.toml b/Cargo.toml index ec6b5178..abb9d7b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,6 @@ members = [ "build_common", "cloud_adapters/in_memory_mock_cloud_adapter", "common", - "contracts", "digital_twin_adapters/in_memory_mock_digital_twin_adapter", "digital_twin_adapters/mock_digital_twin_adapter", "freyja", diff --git a/cloud_adapters/in_memory_mock_cloud_adapter/Cargo.toml b/cloud_adapters/in_memory_mock_cloud_adapter/Cargo.toml index 1728ae66..550f3554 100644 --- a/cloud_adapters/in_memory_mock_cloud_adapter/Cargo.toml +++ b/cloud_adapters/in_memory_mock_cloud_adapter/Cargo.toml @@ -10,7 +10,7 @@ license = "MIT" [dependencies] async-trait = { workspace = true } -freyja-contracts = { workspace = true } +freyja-common = { workspace = true } log = { workspace = true } serde_json = { workspace = true } tokio = { workspace = true } diff --git a/cloud_adapters/in_memory_mock_cloud_adapter/src/in_memory_mock_cloud_adapter.rs b/cloud_adapters/in_memory_mock_cloud_adapter/src/in_memory_mock_cloud_adapter.rs index b6e15c0a..21184731 100644 --- a/cloud_adapters/in_memory_mock_cloud_adapter/src/in_memory_mock_cloud_adapter.rs +++ b/cloud_adapters/in_memory_mock_cloud_adapter/src/in_memory_mock_cloud_adapter.rs @@ -5,7 +5,7 @@ use async_trait::async_trait; use log::{debug, info}; -use freyja_contracts::cloud_adapter::{ +use freyja_common::cloud_adapter::{ CloudAdapter, CloudAdapterError, CloudMessageRequest, CloudMessageResponse, }; diff --git a/common/Cargo.toml b/common/Cargo.toml index 2d5c3d2d..6fd90318 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -9,11 +9,14 @@ edition = "2021" license = "MIT" [dependencies] +async-trait = { workspace = true } config = { workspace = true } -freyja-contracts = { workspace = true } +crossbeam = { workspace = true } home = { workspace = true } log = { workspace = true } proc-macros = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } +strum = { workspace = true } +strum_macros = { workspace = true } tokio = { workspace = true } \ No newline at end of file diff --git a/contracts/src/cloud_adapter.rs b/common/src/cloud_adapter.rs similarity index 100% rename from contracts/src/cloud_adapter.rs rename to common/src/cloud_adapter.rs diff --git a/contracts/src/conversion.rs b/common/src/conversion.rs similarity index 97% rename from contracts/src/conversion.rs rename to common/src/conversion.rs index dc21edfc..af94def8 100644 --- a/contracts/src/conversion.rs +++ b/common/src/conversion.rs @@ -34,7 +34,7 @@ impl Conversion { /// /// # Example /// ```rust - /// use freyja_contracts::conversion::Conversion; + /// use freyja_common::conversion::Conversion; /// let c2f = Conversion::c_to_f(); /// assert!(42.0 == c2f.inverse().apply(c2f.apply(42.0))); /// ``` @@ -56,7 +56,7 @@ impl Conversion { /// /// # Example /// ```rust - /// use freyja_contracts::conversion::Conversion; + /// use freyja_common::conversion::Conversion; /// let c2f = Conversion::c_to_f(); /// assert!(32.0 == c2f.apply(0.0)); /// assert!(212.0 == c2f.apply(100.0)); diff --git a/contracts/src/digital_twin_adapter.rs b/common/src/digital_twin_adapter.rs similarity index 100% rename from contracts/src/digital_twin_adapter.rs rename to common/src/digital_twin_adapter.rs diff --git a/contracts/src/digital_twin_map_entry.rs b/common/src/digital_twin_map_entry.rs similarity index 100% rename from contracts/src/digital_twin_map_entry.rs rename to common/src/digital_twin_map_entry.rs diff --git a/contracts/src/entity.rs b/common/src/entity.rs similarity index 100% rename from contracts/src/entity.rs rename to common/src/entity.rs diff --git a/common/src/lib.rs b/common/src/lib.rs index c6244476..9d11173d 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -2,10 +2,19 @@ // Licensed under the MIT license. // SPDX-License-Identifier: MIT +pub mod cloud_adapter; pub mod cmd_utils; pub mod config_utils; +pub mod conversion; +pub mod digital_twin_adapter; +pub mod digital_twin_map_entry; +pub mod entity; +pub mod mapping_client; pub mod message_utils; +pub mod provider_proxy; +pub mod provider_proxy_selector; pub mod retry_utils; +pub mod signal; pub mod signal_store; /// Expands to `env!("OUT_DIR")`. diff --git a/contracts/src/mapping_client.rs b/common/src/mapping_client.rs similarity index 100% rename from contracts/src/mapping_client.rs rename to common/src/mapping_client.rs diff --git a/contracts/src/provider_proxy.rs b/common/src/provider_proxy.rs similarity index 100% rename from contracts/src/provider_proxy.rs rename to common/src/provider_proxy.rs diff --git a/contracts/src/provider_proxy_selector.rs b/common/src/provider_proxy_selector.rs similarity index 100% rename from contracts/src/provider_proxy_selector.rs rename to common/src/provider_proxy_selector.rs diff --git a/contracts/src/signal.rs b/common/src/signal.rs similarity index 100% rename from contracts/src/signal.rs rename to common/src/signal.rs diff --git a/common/src/signal_store.rs b/common/src/signal_store.rs index 613f0eb4..ece3f467 100644 --- a/common/src/signal_store.rs +++ b/common/src/signal_store.rs @@ -4,7 +4,7 @@ use std::{collections::HashMap, sync::RwLock}; -use freyja_contracts::signal::{Emission, Signal, SignalPatch}; +use crate::signal::{Emission, Signal, SignalPatch}; /// Stores signals and allows access in a thread-safe manner with support for multiple concurrent readers. /// Suitable for use as `Arc`. @@ -214,7 +214,7 @@ mod signal_store_tests { use std::collections::HashSet; - use freyja_contracts::{ + use crate::{ conversion::Conversion, entity::{Entity, EntityEndpoint}, signal::{Emission, EmissionPolicy, Target}, diff --git a/contracts/Cargo.toml b/contracts/Cargo.toml deleted file mode 100644 index dca26ad7..00000000 --- a/contracts/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT license. -# SPDX-License-Identifier: MIT - -[package] -name = "freyja-contracts" -version = "0.1.0" -edition = "2021" -license = "MIT" - -[dependencies] -async-trait = { workspace = true } -crossbeam = { workspace = true } -proc-macros = { workspace = true } -serde = { workspace = true } -strum = { workspace = true } -strum_macros = { workspace = true } \ No newline at end of file diff --git a/contracts/src/lib.rs b/contracts/src/lib.rs deleted file mode 100644 index 09bc4c7d..00000000 --- a/contracts/src/lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. -// SPDX-License-Identifier: MIT - -pub mod cloud_adapter; -pub mod conversion; -pub mod digital_twin_adapter; -pub mod digital_twin_map_entry; -pub mod entity; -pub mod mapping_client; -pub mod provider_proxy; -pub mod provider_proxy_selector; -pub mod signal; diff --git a/digital_twin_adapters/in_memory_mock_digital_twin_adapter/Cargo.toml b/digital_twin_adapters/in_memory_mock_digital_twin_adapter/Cargo.toml index b4fdba71..67149e53 100644 --- a/digital_twin_adapters/in_memory_mock_digital_twin_adapter/Cargo.toml +++ b/digital_twin_adapters/in_memory_mock_digital_twin_adapter/Cargo.toml @@ -12,7 +12,6 @@ license = "MIT" async-trait = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } serde = { workspace = true } tokio = { workspace = true } diff --git a/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/config.rs b/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/config.rs index d86cce36..200c1af5 100644 --- a/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/config.rs +++ b/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/config.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; -use freyja_contracts::entity::Entity; +use freyja_common::entity::Entity; /// The in-memory mock digital twin's config #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs b/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs index 0d3b0cd0..ef9ca8af 100644 --- a/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs +++ b/digital_twin_adapters/in_memory_mock_digital_twin_adapter/src/in_memory_mock_digital_twin_adapter.rs @@ -6,11 +6,11 @@ use async_trait::async_trait; use crate::config::Config; use freyja_build_common::config_file_stem; -use freyja_common::{config_utils, out_dir}; -use freyja_contracts::digital_twin_adapter::{ +use freyja_common::digital_twin_adapter::{ DigitalTwinAdapter, DigitalTwinAdapterError, DigitalTwinAdapterErrorKind, FindByIdRequest, FindByIdResponse, }; +use freyja_common::{config_utils, out_dir}; /// In-memory mock that mocks finding endpoint info about entities /// through find by id @@ -68,7 +68,7 @@ mod in_memory_mock_digital_twin_adapter_tests { use super::*; use crate::config::EntityConfig; - use freyja_contracts::entity::{Entity, EntityEndpoint}; + use freyja_common::entity::{Entity, EntityEndpoint}; const OPERATION: &str = "Subscribe"; diff --git a/digital_twin_adapters/mock_digital_twin_adapter/Cargo.toml b/digital_twin_adapters/mock_digital_twin_adapter/Cargo.toml index 26156825..f8bba91c 100644 --- a/digital_twin_adapters/mock_digital_twin_adapter/Cargo.toml +++ b/digital_twin_adapters/mock_digital_twin_adapter/Cargo.toml @@ -12,7 +12,6 @@ license = "MIT" async-trait = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } mock-digital-twin = { workspace = true } reqwest = { workspace = true } serde = { workspace = true } diff --git a/digital_twin_adapters/mock_digital_twin_adapter/src/mock_digital_twin_adapter.rs b/digital_twin_adapters/mock_digital_twin_adapter/src/mock_digital_twin_adapter.rs index a4aac066..88e8c630 100644 --- a/digital_twin_adapters/mock_digital_twin_adapter/src/mock_digital_twin_adapter.rs +++ b/digital_twin_adapters/mock_digital_twin_adapter/src/mock_digital_twin_adapter.rs @@ -7,10 +7,10 @@ use reqwest::Client; use crate::config::Config; use freyja_build_common::config_file_stem; -use freyja_common::{config_utils, out_dir}; -use freyja_contracts::digital_twin_adapter::{ +use freyja_common::digital_twin_adapter::{ DigitalTwinAdapter, DigitalTwinAdapterError, FindByIdRequest, FindByIdResponse, }; +use freyja_common::{config_utils, out_dir}; use mock_digital_twin::ENTITY_QUERY_PATH; /// Mocks a Digital Twin Adapter that calls the mocks/mock_digital_twin diff --git a/freyja/Cargo.toml b/freyja/Cargo.toml index 13074a2c..72f3de5f 100644 --- a/freyja/Cargo.toml +++ b/freyja/Cargo.toml @@ -11,7 +11,6 @@ license = "MIT" [dependencies] crossbeam = { workspace = true } env_logger = { workspace = true } -freyja-contracts = { workspace = true } freyja-common = { workspace = true } log = { workspace = true } proc-macros = { workspace = true } diff --git a/freyja/src/cartographer.rs b/freyja/src/cartographer.rs index c90ff457..462aa150 100644 --- a/freyja/src/cartographer.rs +++ b/freyja/src/cartographer.rs @@ -9,7 +9,7 @@ use tokio::sync::Mutex; use log::{debug, info, warn}; use freyja_common::signal_store::SignalStore; -use freyja_contracts::{ +use freyja_common::{ conversion::Conversion, digital_twin_adapter::{ DigitalTwinAdapter, DigitalTwinAdapterError, DigitalTwinAdapterErrorKind, FindByIdRequest, @@ -231,7 +231,7 @@ mod cartographer_tests { use async_trait::async_trait; use mockall::{predicate::eq, *}; - use freyja_contracts::{ + use freyja_common::{ digital_twin_adapter::{DigitalTwinAdapterError, FindByIdResponse}, digital_twin_map_entry::DigitalTwinMapEntry, entity::{Entity, EntityEndpoint}, diff --git a/freyja/src/emitter.rs b/freyja/src/emitter.rs index 7eec67f4..2914b845 100644 --- a/freyja/src/emitter.rs +++ b/freyja/src/emitter.rs @@ -10,7 +10,7 @@ use time::OffsetDateTime; use tokio::{sync::Mutex, time::sleep}; use freyja_common::signal_store::SignalStore; -use freyja_contracts::{ +use freyja_common::{ cloud_adapter::{CloudAdapter, CloudMessageRequest, CloudMessageResponse}, provider_proxy::SignalValue, provider_proxy_selector::ProviderProxySelector, @@ -227,7 +227,7 @@ mod emitter_tests { use async_trait::async_trait; - use freyja_contracts::{ + use freyja_common::{ cloud_adapter::{CloudAdapterError, CloudAdapterErrorKind}, entity::Entity, provider_proxy::ProviderProxyFactory, diff --git a/freyja/src/lib.rs b/freyja/src/lib.rs index 1f3024d8..21196f7f 100644 --- a/freyja/src/lib.rs +++ b/freyja/src/lib.rs @@ -18,14 +18,14 @@ use tokio::sync::Mutex; use cartographer::Cartographer; use emitter::Emitter; use freyja_common::{ - cmd_utils::{get_log_level, parse_args}, - signal_store::SignalStore, -}; -use freyja_contracts::{ cloud_adapter::CloudAdapter, digital_twin_adapter::DigitalTwinAdapter, mapping_client::MappingClient, provider_proxy::SignalValue, provider_proxy_selector::ProviderProxySelector, }; +use freyja_common::{ + cmd_utils::{get_log_level, parse_args}, + signal_store::SignalStore, +}; use provider_proxy_selector::provider_proxy_selector_impl::ProviderProxySelectorImpl; use grpc_provider_proxy_v1::grpc_provider_proxy_factory::GRPCProviderProxyFactory; diff --git a/mapping_clients/in_memory_mock_mapping_client/Cargo.toml b/mapping_clients/in_memory_mock_mapping_client/Cargo.toml index 65bf0163..009285de 100644 --- a/mapping_clients/in_memory_mock_mapping_client/Cargo.toml +++ b/mapping_clients/in_memory_mock_mapping_client/Cargo.toml @@ -12,7 +12,6 @@ license = "MIT" async-trait = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } serde = { workspace = true } tokio = { workspace = true } diff --git a/mapping_clients/in_memory_mock_mapping_client/src/config.rs b/mapping_clients/in_memory_mock_mapping_client/src/config.rs index 47157563..560b205c 100644 --- a/mapping_clients/in_memory_mock_mapping_client/src/config.rs +++ b/mapping_clients/in_memory_mock_mapping_client/src/config.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; -use freyja_contracts::digital_twin_map_entry::DigitalTwinMapEntry; +use freyja_common::digital_twin_map_entry::DigitalTwinMapEntry; /// The in-memory mock mapping client's config #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/mapping_clients/in_memory_mock_mapping_client/src/in_memory_mock_mapping_client.rs b/mapping_clients/in_memory_mock_mapping_client/src/in_memory_mock_mapping_client.rs index 93a1c09d..65f0d448 100644 --- a/mapping_clients/in_memory_mock_mapping_client/src/in_memory_mock_mapping_client.rs +++ b/mapping_clients/in_memory_mock_mapping_client/src/in_memory_mock_mapping_client.rs @@ -8,8 +8,8 @@ use async_trait::async_trait; use crate::config::Config; use freyja_build_common::config_file_stem; +use freyja_common::mapping_client::*; use freyja_common::{config_utils, out_dir}; -use freyja_contracts::mapping_client::*; /// Mocks a mapping provider in memory pub struct InMemoryMockMappingClient { @@ -99,7 +99,7 @@ mod in_memory_mock_mapping_client_tests { use std::collections::{HashMap, HashSet}; - use freyja_contracts::{conversion::Conversion, digital_twin_map_entry::DigitalTwinMapEntry}; + use freyja_common::{conversion::Conversion, digital_twin_map_entry::DigitalTwinMapEntry}; #[test] fn can_create_new() { diff --git a/mapping_clients/mock_mapping_service_client/Cargo.toml b/mapping_clients/mock_mapping_service_client/Cargo.toml index 0d734be2..cbc9c6d9 100644 --- a/mapping_clients/mock_mapping_service_client/Cargo.toml +++ b/mapping_clients/mock_mapping_service_client/Cargo.toml @@ -12,7 +12,6 @@ license = "MIT" async-trait = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } reqwest = { workspace = true } serde = { workspace = true } diff --git a/mapping_clients/mock_mapping_service_client/src/mock_mapping_service_client.rs b/mapping_clients/mock_mapping_service_client/src/mock_mapping_service_client.rs index a4398d79..c06b9df0 100644 --- a/mapping_clients/mock_mapping_service_client/src/mock_mapping_service_client.rs +++ b/mapping_clients/mock_mapping_service_client/src/mock_mapping_service_client.rs @@ -9,8 +9,8 @@ use reqwest::Client; use crate::config::Config; use freyja_build_common::config_file_stem; +use freyja_common::mapping_client::*; use freyja_common::{config_utils, out_dir, retry_utils::execute_with_retry}; -use freyja_contracts::mapping_client::*; /// Mocks a mapping provider in memory pub struct MockMappingServiceClient { diff --git a/mocks/mock_digital_twin/Cargo.toml b/mocks/mock_digital_twin/Cargo.toml index 368badb8..55d81a8f 100644 --- a/mocks/mock_digital_twin/Cargo.toml +++ b/mocks/mock_digital_twin/Cargo.toml @@ -13,7 +13,6 @@ axum = { workspace = true } env_logger = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } log = { workspace = true } reqwest = { workspace = true } serde = { workspace = true } diff --git a/mocks/mock_digital_twin/src/config.rs b/mocks/mock_digital_twin/src/config.rs index af02c843..49f1cf88 100644 --- a/mocks/mock_digital_twin/src/config.rs +++ b/mocks/mock_digital_twin/src/config.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; -use freyja_contracts::entity::Entity; +use freyja_common::entity::Entity; /// Config for the mock digital twin #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/mocks/mock_digital_twin/src/main.rs b/mocks/mock_digital_twin/src/main.rs index 663ffc7d..9f715076 100644 --- a/mocks/mock_digital_twin/src/main.rs +++ b/mocks/mock_digital_twin/src/main.rs @@ -21,8 +21,8 @@ use tokio::sync::{mpsc, mpsc::UnboundedSender}; use crate::config::{Config, EntityConfig}; use freyja_build_common::config_file_stem; +use freyja_common::digital_twin_adapter::FindByIdResponse; use freyja_common::{config_utils, out_dir}; -use freyja_contracts::digital_twin_adapter::FindByIdResponse; use http_mock_provider_proxy::http_mock_provider_proxy::{EntityValueRequest, EntityValueResponse}; use mock_digital_twin::{ENTITY_GET_VALUE_PATH, ENTITY_PATH, ENTITY_SUBSCRIBE_PATH}; diff --git a/mocks/mock_mapping_service/Cargo.toml b/mocks/mock_mapping_service/Cargo.toml index 16ee660a..9a7ef24d 100644 --- a/mocks/mock_mapping_service/Cargo.toml +++ b/mocks/mock_mapping_service/Cargo.toml @@ -13,7 +13,6 @@ axum = { workspace = true } env_logger = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } log = { workspace = true } serde = { workspace = true } tokio = { workspace = true } diff --git a/mocks/mock_mapping_service/src/config.rs b/mocks/mock_mapping_service/src/config.rs index 604b0b34..637bc589 100644 --- a/mocks/mock_mapping_service/src/config.rs +++ b/mocks/mock_mapping_service/src/config.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; -use freyja_contracts::digital_twin_map_entry::DigitalTwinMapEntry; +use freyja_common::digital_twin_map_entry::DigitalTwinMapEntry; /// The mock mapping service's config #[derive(Clone, Debug, Serialize, Deserialize)] diff --git a/mocks/mock_mapping_service/src/main.rs b/mocks/mock_mapping_service/src/main.rs index 6ef23aa8..e0a501f5 100644 --- a/mocks/mock_mapping_service/src/main.rs +++ b/mocks/mock_mapping_service/src/main.rs @@ -22,13 +22,13 @@ use log::{info, LevelFilter}; use config::Config; use freyja_build_common::config_file_stem; +use freyja_common::mapping_client::{ + CheckForWorkResponse, GetMappingResponse, SendInventoryRequest, SendInventoryResponse, +}; use freyja_common::{ cmd_utils::{get_log_level, parse_args}, config_utils, out_dir, }; -use freyja_contracts::mapping_client::{ - CheckForWorkResponse, GetMappingResponse, SendInventoryRequest, SendInventoryResponse, -}; struct MappingState { count: u8, diff --git a/provider_proxies/grpc/v1/Cargo.toml b/provider_proxies/grpc/v1/Cargo.toml index a434df22..713fdc98 100644 --- a/provider_proxies/grpc/v1/Cargo.toml +++ b/provider_proxies/grpc/v1/Cargo.toml @@ -13,7 +13,6 @@ async-trait = { workspace = true } crossbeam = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } futures = { workspace = true } log = { workspace = true } samples-protobuf-data-access = { workspace = true } diff --git a/provider_proxies/grpc/v1/src/grpc_client_impl.rs b/provider_proxies/grpc/v1/src/grpc_client_impl.rs index 17a4c1de..8674dfda 100644 --- a/provider_proxies/grpc/v1/src/grpc_client_impl.rs +++ b/provider_proxies/grpc/v1/src/grpc_client_impl.rs @@ -9,7 +9,7 @@ use freyja_common::message_utils; use log::{debug, warn}; use tonic::{Request, Response, Status}; -use freyja_contracts::provider_proxy::SignalValue; +use freyja_common::provider_proxy::SignalValue; use samples_protobuf_data_access::sample_grpc::v1::digital_twin_consumer::{ digital_twin_consumer_server::DigitalTwinConsumer, PublishRequest, PublishResponse, RespondRequest, RespondResponse, diff --git a/provider_proxies/grpc/v1/src/grpc_provider_proxy.rs b/provider_proxies/grpc/v1/src/grpc_provider_proxy.rs index 34df233a..9b336ece 100644 --- a/provider_proxies/grpc/v1/src/grpc_provider_proxy.rs +++ b/provider_proxies/grpc/v1/src/grpc_provider_proxy.rs @@ -21,7 +21,7 @@ use tonic::transport::{Channel, Server}; use crate::{config::Config, grpc_client_impl::GRPCClientImpl, GET_OPERATION, SUBSCRIBE_OPERATION}; use freyja_build_common::config_file_stem; use freyja_common::{config_utils, out_dir}; -use freyja_contracts::{ +use freyja_common::{ entity::EntityEndpoint, provider_proxy::{ EntityRegistration, ProviderProxy, ProviderProxyError, ProviderProxyErrorKind, SignalValue, diff --git a/provider_proxies/grpc/v1/src/grpc_provider_proxy_factory.rs b/provider_proxies/grpc/v1/src/grpc_provider_proxy_factory.rs index 374cd247..3405ded4 100644 --- a/provider_proxies/grpc/v1/src/grpc_provider_proxy_factory.rs +++ b/provider_proxies/grpc/v1/src/grpc_provider_proxy_factory.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use crossbeam::queue::SegQueue; -use freyja_contracts::{ +use freyja_common::{ entity::{Entity, EntityEndpoint}, provider_proxy::{ProviderProxy, ProviderProxyError, ProviderProxyFactory, SignalValue}, }; diff --git a/provider_proxies/http_mock_provider_proxy/Cargo.toml b/provider_proxies/http_mock_provider_proxy/Cargo.toml index c51f73ad..4589b688 100644 --- a/provider_proxies/http_mock_provider_proxy/Cargo.toml +++ b/provider_proxies/http_mock_provider_proxy/Cargo.toml @@ -14,7 +14,6 @@ axum = { workspace = true } crossbeam = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } log = { workspace = true } reqwest = { workspace = true } serde = { workspace = true } diff --git a/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy.rs b/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy.rs index 9b60715d..cd41a2f9 100644 --- a/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy.rs +++ b/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy.rs @@ -18,11 +18,11 @@ use serde::{Deserialize, Serialize}; use crate::config::Config; use crate::{GET_OPERATION, SUBSCRIBE_OPERATION}; use freyja_build_common::config_file_stem; -use freyja_common::{config_utils, out_dir}; -use freyja_contracts::entity::EntityEndpoint; -use freyja_contracts::provider_proxy::{ +use freyja_common::entity::EntityEndpoint; +use freyja_common::provider_proxy::{ EntityRegistration, ProviderProxy, ProviderProxyError, ProviderProxyErrorKind, SignalValue, }; +use freyja_common::{config_utils, out_dir}; const CALLBACK_FOR_VALUES_PATH: &str = "/value"; diff --git a/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy_factory.rs b/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy_factory.rs index 893443e1..98e9b07e 100644 --- a/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy_factory.rs +++ b/provider_proxies/http_mock_provider_proxy/src/http_mock_provider_proxy_factory.rs @@ -15,7 +15,7 @@ use crate::{ }; use freyja_build_common::config_file_stem; use freyja_common::{config_utils, out_dir}; -use freyja_contracts::{ +use freyja_common::{ entity::{Entity, EntityEndpoint}, provider_proxy::{ProviderProxy, ProviderProxyError, ProviderProxyFactory, SignalValue}, }; diff --git a/provider_proxies/in_memory_mock_provider_proxy/Cargo.toml b/provider_proxies/in_memory_mock_provider_proxy/Cargo.toml index 37ea471d..2c4a0ae9 100644 --- a/provider_proxies/in_memory_mock_provider_proxy/Cargo.toml +++ b/provider_proxies/in_memory_mock_provider_proxy/Cargo.toml @@ -13,7 +13,6 @@ async-trait = { workspace = true } crossbeam = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } log = { workspace = true } serde = { workspace = true } tokio = { workspace = true } diff --git a/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy.rs b/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy.rs index 482db274..c3fcf41e 100644 --- a/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy.rs +++ b/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy.rs @@ -20,7 +20,7 @@ use crate::{ GET_OPERATION, SUBSCRIBE_OPERATION, }; use freyja_build_common::config_file_stem; -use freyja_contracts::{ +use freyja_common::{ entity::EntityEndpoint, provider_proxy::{ EntityRegistration, ProviderProxy, ProviderProxyError, ProviderProxyErrorKind, SignalValue, diff --git a/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy_factory.rs b/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy_factory.rs index dbbf5dd9..c3276113 100644 --- a/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy_factory.rs +++ b/provider_proxies/in_memory_mock_provider_proxy/src/in_memory_mock_provider_proxy_factory.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use crossbeam::queue::SegQueue; -use freyja_contracts::{ +use freyja_common::{ entity::{Entity, EntityEndpoint}, provider_proxy::{ProviderProxy, ProviderProxyError, ProviderProxyFactory, SignalValue}, }; diff --git a/provider_proxies/managed_subscribe/Cargo.toml b/provider_proxies/managed_subscribe/Cargo.toml index bb944c5f..aead7dca 100644 --- a/provider_proxies/managed_subscribe/Cargo.toml +++ b/provider_proxies/managed_subscribe/Cargo.toml @@ -14,7 +14,6 @@ core-protobuf-data-access = { workspace = true } crossbeam = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } futures = { workspace = true } log = { workspace = true } paho-mqtt = { workspace = true } diff --git a/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy.rs b/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy.rs index 8079104b..994e4d01 100644 --- a/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy.rs +++ b/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy.rs @@ -19,7 +19,7 @@ use crate::{ }; use freyja_build_common::config_file_stem; use freyja_common::{config_utils, out_dir}; -use freyja_contracts::{ +use freyja_common::{ entity::{Entity, EntityEndpoint}, provider_proxy::{ EntityRegistration, ProviderProxy, ProviderProxyError, ProviderProxyErrorKind, SignalValue, diff --git a/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy_factory.rs b/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy_factory.rs index ce907139..5201b871 100644 --- a/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy_factory.rs +++ b/provider_proxies/managed_subscribe/src/managed_subscribe_provider_proxy_factory.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use crossbeam::queue::SegQueue; -use freyja_contracts::{ +use freyja_common::{ entity::{Entity, EntityEndpoint}, provider_proxy::{ProviderProxy, ProviderProxyError, ProviderProxyFactory, SignalValue}, }; diff --git a/provider_proxies/mqtt/Cargo.toml b/provider_proxies/mqtt/Cargo.toml index bd3eede5..c7430bc7 100644 --- a/provider_proxies/mqtt/Cargo.toml +++ b/provider_proxies/mqtt/Cargo.toml @@ -13,7 +13,6 @@ async-trait = { workspace = true } crossbeam = { workspace = true } freyja-build-common = { workspace = true } freyja-common = { workspace = true } -freyja-contracts = { workspace = true } log = { workspace = true } paho-mqtt = { workspace = true } serde = { workspace = true } diff --git a/provider_proxies/mqtt/src/mqtt_provider_proxy.rs b/provider_proxies/mqtt/src/mqtt_provider_proxy.rs index c3c2229d..5e13d42b 100644 --- a/provider_proxies/mqtt/src/mqtt_provider_proxy.rs +++ b/provider_proxies/mqtt/src/mqtt_provider_proxy.rs @@ -14,7 +14,7 @@ use uuid::Uuid; use crate::{config::Config, MQTT_PROTOCOL, SUBSCRIBE_OPERATION}; use freyja_build_common::config_file_stem; use freyja_common::{config_utils, message_utils, out_dir}; -use freyja_contracts::{ +use freyja_common::{ entity::EntityEndpoint, provider_proxy::{ EntityRegistration, ProviderProxy, ProviderProxyError, ProviderProxyErrorKind, SignalValue, diff --git a/provider_proxies/mqtt/src/mqtt_provider_proxy_factory.rs b/provider_proxies/mqtt/src/mqtt_provider_proxy_factory.rs index 6d9757aa..0c51be06 100644 --- a/provider_proxies/mqtt/src/mqtt_provider_proxy_factory.rs +++ b/provider_proxies/mqtt/src/mqtt_provider_proxy_factory.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use crossbeam::queue::SegQueue; -use freyja_contracts::{ +use freyja_common::{ entity::{Entity, EntityEndpoint}, provider_proxy::{ProviderProxy, ProviderProxyError, ProviderProxyFactory, SignalValue}, }; diff --git a/provider_proxy_selector/Cargo.toml b/provider_proxy_selector/Cargo.toml index e4f7e534..2f20f79a 100644 --- a/provider_proxy_selector/Cargo.toml +++ b/provider_proxy_selector/Cargo.toml @@ -11,7 +11,7 @@ license = "MIT" [dependencies] async-trait = { workspace = true } crossbeam = { workspace = true } -freyja-contracts = { workspace = true } +freyja-common = { workspace = true } log = { workspace = true } tokio = { workspace = true } diff --git a/provider_proxy_selector/src/provider_proxy_selector_impl.rs b/provider_proxy_selector/src/provider_proxy_selector_impl.rs index d7b44e47..60f2e152 100644 --- a/provider_proxy_selector/src/provider_proxy_selector_impl.rs +++ b/provider_proxy_selector/src/provider_proxy_selector_impl.rs @@ -12,7 +12,7 @@ use crossbeam::queue::SegQueue; use log::debug; use tokio::sync::Mutex; -use freyja_contracts::{ +use freyja_common::{ entity::Entity, provider_proxy::{EntityRegistration, ProviderProxy, ProviderProxyFactory, SignalValue}, provider_proxy_selector::{ @@ -223,7 +223,7 @@ impl ProviderProxySelector for ProviderProxySelectorImpl { mod provider_proxy_selector_tests { use super::*; - use freyja_contracts::{ + use freyja_common::{ entity::EntityEndpoint, provider_proxy_selector::ProviderProxySelectorErrorKind, }; use grpc_provider_proxy_v1::grpc_provider_proxy_factory::GRPCProviderProxyFactory;