Skip to content

Commit

Permalink
Fix formatting and revert proto folder structure due to linting error
Browse files Browse the repository at this point in the history
  • Loading branch information
ladatz committed Jan 24, 2024
1 parent cdfd6be commit ed3db9e
Show file tree
Hide file tree
Showing 40 changed files with 81 additions and 69 deletions.
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.file_descriptor_set_path(out_dir.join("descriptor.bin"))
.compile(
&[
"./proto/runtime/v1/runtime.proto",
"./proto/provider/v1/provider.proto",
"./proto/intent_brokering/runtime/v1/runtime.proto",
"./proto/intent_brokering/provider/v1/provider.proto",
],
&["./proto/"],
)?;
Expand Down
4 changes: 2 additions & 2 deletions docs/adr/0020-integration-and-e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ well as from the CI.

Integration tests will be invoking the Chariott runtime server code directly,
without using the [upstream gRPC
layer](../../proto/chariott/runtime/v1/runtime.proto). We will not mock out any parts
layer](../../intent_brokering/proto/intent_brokering/runtime/v1/runtime.proto). We will not mock out any parts
from the Chariott runtime when integration testing, hence we will need to set up
a provider that is exposing a gRPC endpoint in order to handle intent
fulfillments.
Expand Down Expand Up @@ -88,4 +88,4 @@ This approach is equivalent to the setup in [ADR
`cargo test`, and come with the advantages a test framework has without
taking a dependency on test framework which we do not already use.

[charc]: ../../tools/charc.md
[charc]: ../../intent_brokering/tools/charc.md
2 changes: 1 addition & 1 deletion intent_brokering/ess/benches/load_bench.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use intent_brokering_common::tokio_runtime_fork::BuilderExt;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use ess::EventSubSystem;
use futures::StreamExt;
use intent_brokering_common::tokio_runtime_fork::BuilderExt;
use std::sync::Arc;
use tokio::sync::broadcast::{self, Receiver};
type Ess = EventSubSystem<ClientId, EventId, Event, Event>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

use intent_brokering_common::error::{Error, ResultExt};
use examples_common::examples::detection::{DetectRequest, DetectResponse, DetectionObject};
use intent_brokering_common::error::{Error, ResultExt};
use reqwest::Client;
use serde::{Deserialize, Serialize};
use std::{env, mem};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

mod intent_provider;
mod detection;
mod intent_provider;

use examples_common::chariott;
use intent_brokering_common::error::Error;
use intent_brokering_common::shutdown::RouterExt as _;
use intent_brokering_proto::{
provider::provider_service_server::ProviderServiceServer,
runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality},
};
use examples_common::chariott;
use tonic::transport::Server;

use crate::intent_provider::IntentProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use anyhow::{anyhow, Error};
use async_stream::try_stream;
use intent_brokering_proto::common::Blob;
use examples_common::{
chariott::{
api::{Chariott, ChariottExt as _, GrpcChariott},
Expand All @@ -13,6 +12,7 @@ use examples_common::{
examples::proto::detection::{DetectRequest, DetectResponse},
};
use futures::{stream::BoxStream, TryStreamExt};
use intent_brokering_proto::common::Blob;
use tokio_stream::StreamExt;
use tracing::{info, warn};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ async fn on_dog_mode_timer(
#[cfg(test)]
mod tests {
use async_trait::async_trait;
use intent_brokering_common::error::Error;
use examples_common::chariott::{api::Service, inspection::Entry};
use intent_brokering_common::error::Error;

use super::*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ mod intent_provider;

use std::sync::Arc;

use examples_common::chariott;
use intent_brokering_common::error::Error;
use intent_brokering_common::shutdown::RouterExt as _;
use intent_brokering_proto::{
provider::provider_service_server::ProviderServiceServer,
runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality},
};
use examples_common::chariott;
use tonic::transport::Server;

use crate::intent_provider::IntentProvider;
Expand Down
2 changes: 1 addition & 1 deletion intent_brokering/examples/applications/kv-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Open a channel for receiving events:

```bash
grpcurl -v -plaintext -import-path proto -proto \
intent_brokering/proto/streaming/v1/streaming.proto 0.0.0.0:50064 \
intent_brokering/proto/intent_brokering/streaming/v1/streaming.proto 0.0.0.0:50064 \
intent_brokering.streaming.v1.ChannelService/Open | tee events.log &
```

Expand Down
2 changes: 1 addition & 1 deletion intent_brokering/examples/applications/kv-app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ mod intent_provider;

use std::sync::Arc;

use examples_common::chariott;
use intent_brokering_common::error::Error;
use intent_brokering_common::shutdown::RouterExt as _;
use intent_brokering_proto::{
provider::provider_service_server::ProviderServiceServer,
runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality},
streaming::channel_service_server::ChannelServiceServer,
};
use examples_common::chariott;
use tonic::transport::Server;

use crate::intent_provider::{IntentProvider, StreamingStore};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

use intent_brokering_common::error::Error;
use examples_common::examples::detection::{DetectRequest, DetectResponse, DetectionObject};
use image::{io::Reader, DynamicImage, GenericImageView};
use intent_brokering_common::error::Error;
use ndarray::prelude::Array;
use serde::{Deserialize, Serialize};
use std::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

mod intent_provider;
mod detection;
mod intent_provider;

use examples_common::chariott;
use intent_brokering_common::error::Error;
use intent_brokering_common::shutdown::RouterExt as _;
use intent_brokering_proto::{
provider::provider_service_server::ProviderServiceServer,
runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality},
};
use examples_common::chariott;
use tonic::transport::Server;

use crate::intent_provider::IntentProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
// SPDX-License-Identifier: MIT

use bollard::{container::StatsOptions, Docker};
use intent_brokering_common::{
config::env,
error::{Error, ResultExt},
};
use examples_common::chariott::{
self,
api::{Chariott, GrpcChariott},
value::Value,
};
use futures_util::stream::StreamExt;
use intent_brokering_common::{
config::env,
error::{Error, ResultExt},
};
use metrics_util::Summary;
use serde::Serialize;
use std::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use std::{
time::Duration,
};

use examples_common::chariott;
use examples_common::chariott::value::Value;
use intent_brokering_common::{
config::env,
error::{Error, ResultExt as _},
Expand All @@ -19,8 +21,6 @@ use intent_brokering_proto::{
},
runtime::{intent_registration::Intent, intent_service_registration::ExecutionLocality},
};
use examples_common::chariott;
use examples_common::chariott::value::Value;
use rand::{rngs::SmallRng, SeedableRng};
use rand_distr::{DistIter, Distribution, Normal};
use tokio::time::sleep;
Expand Down
4 changes: 2 additions & 2 deletions intent_brokering/examples/applications/mock-vas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ From the root directory:
1. In a terminal (A) start Chariott with `cargo run`.
2. In another terminal (B) start the mock-vas with `cargo run -p mock-vas`.
3. In a terminal (C), open a channel to the mock-vas with `grpcurl -v -plaintext \
-import-path proto -proto proto/streaming/v1/streaming.proto \
-import-path proto -proto proto/intent_brokering/streaming/v1/streaming.proto \
localhost:50051 intent_brokering.streaming.v1.ChannelService/Open` and take a note of
the returned channel id in the metadata _x-chariott-channel-id_.
4. In another terminal D call the following, using the channel id from the
Expand Down Expand Up @@ -51,7 +51,7 @@ From the root directory:
In order to do so, you need to:
- Implement the [streaming proto](../../../proto/streaming/v1/streaming.proto)
- Implement the [streaming proto](../../../proto/intent_brokering/streaming/v1/streaming.proto)
and specifically the `OpenRequest` endpoint with a service.
- This is done in the common examples library in [streaming.rs](../../common/src/chariott/streaming.rs)
- Make sure to serve this service with your gRPC server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

use intent_brokering_common::shutdown::{ctrl_c_cancellation, RouterExt};
use futures::future::join_all;
use intent_brokering_common::shutdown::{ctrl_c_cancellation, RouterExt};
use std::net::SocketAddr;
use std::sync::Arc;
use tokio::spawn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ 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 intent_brokering_proto::{
common::{
discover_fulfillment::Service, DiscoverFulfillment, FulfillmentEnum, FulfillmentMessage,
IntentEnum, InvokeFulfillment, ValueMessage,
},
provider::{provider_service_server::ProviderService, FulfillRequest, FulfillResponse},
};
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 tonic::{Request, Response, Status};
use url::Url;

Expand Down
4 changes: 2 additions & 2 deletions intent_brokering/examples/applications/mock-vas/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

mod intent_provider;
mod communication;
mod intent_provider;
mod simulation;

use examples_common::chariott;
use intent_brokering_common::error::Error;
use intent_brokering_proto::runtime::{
intent_registration::Intent, intent_service_registration::ExecutionLocality,
};
use examples_common::chariott;

chariott::provider::main!(wain);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

use intent_brokering_common::error::{Error, ResultExt};
use examples_common::chariott::value::Value;
use intent_brokering_common::error::{Error, ResultExt};
use std::{env, sync::Arc};
use tokio::sync::broadcast::{self, Sender};
use tokio_util::sync::CancellationToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ syntax = "proto3";

package examples.detection.v1;

import "common/v1/common.proto";
import "intent_brokering/common/v1/common.proto";

message DetectRequest {
intent_brokering.common.v1.Blob blob = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::{net::SocketAddr, sync::Arc, time::Duration};

use url::Url;

use examples_common::chariott;
use intent_brokering_common::error::Error;
use intent_brokering_common::shutdown::RouterExt as _;
use intent_brokering_proto::{
Expand All @@ -18,7 +19,6 @@ use intent_brokering_proto::{
IntentServiceRegistration, RegisterRequest, RegistrationState,
},
};
use examples_common::chariott;
use tokio::time::sleep;
use tonic::transport::{Channel, Server};
use tracing::warn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ manual mode where you specify the frame rate event yourself.
`intent_brokering/examples/applications/simulated-camera` directory.
5. In another terminal, open a channel to the simulated-camera with `grpcurl -v \
-plaintext -import-path proto -proto \
intent_brokering/proto/streaming/v1/streaming.proto localhost:50066 \
intent_brokering/proto/intent_brokering/streaming/v1/streaming.proto localhost:50066 \
intent_brokering.streaming.v1.ChannelService/Open` and take a note of the returned
channel id in the metadata _x-chariott-channel-id_.
6. In yet another terminal, call the following, using the channel id from the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// SPDX-License-Identifier: MIT

use async_stream::try_stream;
use intent_brokering_common::error::Error;
use core::panic;
use examples_common::chariott::value::Value;
use intent_brokering_common::error::Error;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use std::sync::Arc;
use std::{env::args, net::SocketAddr};

use futures::future::join_all;
use intent_brokering_common::{
error::{Error, ResultExt as _},
shutdown::{ctrl_c_cancellation, RouterExt as _},
Expand All @@ -13,7 +14,6 @@ use intent_brokering_proto::{
provider::provider_service_server::ProviderServiceServer,
streaming::channel_service_server::ChannelServiceServer,
};
use futures::future::join_all;
use tokio::spawn;
use tonic::transport::Server;
use url::Url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// SPDX-License-Identifier: MIT

mod camera;
mod intent_provider;
mod communication;
mod intent_provider;

use examples_common::chariott;
use intent_brokering_common::error::Error;
use intent_brokering_proto::runtime::{
intent_registration::Intent, intent_service_registration::ExecutionLocality,
};
use examples_common::chariott;

chariott::provider::main!(wain);

Expand Down
7 changes: 5 additions & 2 deletions intent_brokering/examples/common/src/chariott/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use std::{
use super::{inspection::Entry as InspectionEntry, value::Value};

use async_trait::async_trait;
use futures::{stream::BoxStream, StreamExt};
use intent_brokering_common::error::{Error, ResultExt as _};
use intent_brokering_proto::{
common::{
Expand All @@ -23,10 +24,12 @@ use intent_brokering_proto::{
InvokeFulfillment, InvokeIntent, ReadFulfillment, ReadIntent, SubscribeFulfillment,
SubscribeIntent, WriteFulfillment, WriteIntent,
},
runtime::{intent_brokering_service_client::IntentBrokeringServiceClient, FulfillRequest, FulfillResponse},
runtime::{
intent_brokering_service_client::IntentBrokeringServiceClient, FulfillRequest,
FulfillResponse,
},
streaming::{channel_service_client::ChannelServiceClient, OpenRequest},
};
use futures::{stream::BoxStream, StreamExt};
use tonic::{transport::Channel, Request, Response};
use tracing::debug;

Expand Down
9 changes: 6 additions & 3 deletions intent_brokering/examples/common/src/chariott/registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ impl Builder {
) -> Result<(), Error> {
if client.is_none() {
*client = Some(
IntentBrokeringServiceClient::connect(self.chariott_url.to_string()).await.map_err_with(
format!("Could not connect to Chariott ({})", self.chariott_url),
)?,
IntentBrokeringServiceClient::connect(self.chariott_url.to_string())
.await
.map_err_with(format!(
"Could not connect to Chariott ({})",
self.chariott_url
))?,
);
}

Expand Down
Loading

1 comment on commit ed3db9e

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESS Benchmark

Benchmark suite Current: ed3db9e Previous: 5886244 Ratio
ess/1-subscribers/1000-events 187983 ns/iter (± 9392) 188873 ns/iter (± 6213) 1.00
ess/10-subscribers/1000-events 1346973 ns/iter (± 35955) 1368890 ns/iter (± 32371) 0.98
ess/100-subscribers/1000-events 13085469 ns/iter (± 747636) 13413472 ns/iter (± 574355) 0.98
ess/1-subscribers/10000-events 1727034 ns/iter (± 50727) 1712373 ns/iter (± 59392) 1.01
ess/10-subscribers/10000-events 13307365 ns/iter (± 62004) 13528032 ns/iter (± 51857) 0.98
ess/100-subscribers/10000-events 130372301 ns/iter (± 2681833) 131653141 ns/iter (± 461857) 0.99

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.