Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
run: |
cargo deny check

# [impl->req~up-language-ci-build~1]
check:
runs-on: ubuntu-latest
steps:
Expand All @@ -73,6 +74,7 @@ jobs:
run: |
cargo check --all --tests

# [impl->req~up-language-ci-linter~1]
fmt:
runs-on: ubuntu-latest
steps:
Expand All @@ -87,6 +89,7 @@ jobs:
run: |
cargo fmt --all -- --check

# [impl->req~up-language-ci-linter~1]
clippy:
runs-on: ubuntu-latest
steps:
Expand All @@ -102,6 +105,7 @@ jobs:
cargo clippy --version
cargo clippy --tests --examples

# [impl->req~up-language-ci-api-docs~1]
docu:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -134,6 +138,7 @@ jobs:
run: |
cargo hack check --feature-powerset --no-dev-deps

# [impl->req~up-language-ci-test~1]
nextest:
# Subset of feature-combos, on only one OS - more complete testing in test-featurematrix.yaml
outputs:
Expand Down Expand Up @@ -166,6 +171,7 @@ jobs:
name: test-results
path: testresults--all-features.json

# [impl->req~up-language-ci-test~1]
doctest:
# Run doctests separately, as nextest doesn't yet (https://github.com/nextest-rs/nextest/issues/16)
outputs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-featurematrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ env:
CARGO_TERM_COLOR: always

jobs:
# [impl->req~up-language-ci-test~1]
test-all-features:
name: all feature combinations
runs-on: ${{ matrix.os }}
Expand Down
6 changes: 5 additions & 1 deletion src/communication/default_notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

// [impl->req~up-language-comm-api-default-impl~1]

use std::sync::Arc;

use async_trait::async_trait;
Expand Down Expand Up @@ -96,7 +98,9 @@ impl Notifier for SimpleNotifier {
}

#[cfg(test)]
mod test {
mod tests {

// [utest->req~up-language-comm-api-default-impl~1]

use super::*;

Expand Down
6 changes: 5 additions & 1 deletion src/communication/default_pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

// [impl->req~up-language-comm-api-default-impl~1]

use std::{
collections::{hash_map::Entry, HashMap},
ops::Deref,
Expand Down Expand Up @@ -452,7 +454,9 @@ impl Subscriber for InMemorySubscriber {
}

#[cfg(test)]
mod test {
mod tests {

// [utest->req~up-language-comm-api-default-impl~1]

use super::*;

Expand Down
4 changes: 4 additions & 0 deletions src/communication/in_memory_rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

// [impl->req~up-language-comm-api-default-impl~1]

use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -264,6 +266,8 @@ impl RpcClient for InMemoryRpcClient {
#[cfg(test)]
mod tests {

// [utest->req~up-language-comm-api-default-impl~1]

use super::*;

use protobuf::{well_known_types::wrappers::StringValue, Enum};
Expand Down
4 changes: 4 additions & 0 deletions src/communication/in_memory_rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

// [impl->req~up-language-comm-api-default-impl~1]

use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::sync::Arc;
Expand Down Expand Up @@ -280,6 +282,8 @@ impl RpcServer for InMemoryRpcServer {
#[cfg(test)]
mod tests {

// [utest->req~up-language-comm-api-default-impl~1]

use super::*;

use protobuf::well_known_types::wrappers::StringValue;
Expand Down
2 changes: 2 additions & 0 deletions src/communication/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use crate::{UListener, UStatus, UUri};
use super::{CallOptions, UPayload};

/// An error indicating a problem with sending a notification to another uEntity.
// [impl->req~up-language-comm-api~1]
#[derive(Debug)]
pub enum NotificationError {
/// Indicates that the given message cannot be sent because it is not a [valid Notification message](crate::NotificationValidator).
Expand All @@ -48,6 +49,7 @@ impl Error for NotificationError {}
///
/// Please refer to the
/// [Communication Layer API Specifications](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-l2/api.adoc).
// [impl->req~up-language-comm-api~1]
#[cfg_attr(test, automock)]
#[async_trait]
pub trait Notifier: Send + Sync {
Expand Down
4 changes: 4 additions & 0 deletions src/communication/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::{UListener, UStatus, UUri};
use super::{CallOptions, UPayload};

/// An error indicating a problem with publishing a message to a topic.
// [impl->req~up-language-comm-api~1]
#[derive(Debug)]
pub enum PubSubError {
/// Indicates that the given message cannot be sent because it is not a [valid Publish message](crate::PublishValidator).
Expand All @@ -49,6 +50,7 @@ impl Error for PubSubError {}
///
/// Please refer to the
/// [Communication Layer API Specifications](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-l2/api.adoc).
// [impl->req~up-language-comm-api~1]
#[async_trait]
pub trait Publisher: Send + Sync {
/// Publishes a message to a topic.
Expand All @@ -70,6 +72,7 @@ pub trait Publisher: Send + Sync {
) -> Result<(), PubSubError>;
}

// [impl->req~up-language-comm-api~1]
#[cfg_attr(test, automock)]
pub trait SubscriptionChangeHandler: Send + Sync {
/// Invoked for each update to the subscription status for a given topic.
Expand All @@ -87,6 +90,7 @@ pub trait SubscriptionChangeHandler: Send + Sync {
///
/// Please refer to the
/// [Communication Layer API Specifications](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-l2/api.adoc).
// [impl->req~up-language-comm-api~1]
#[async_trait]
pub trait Subscriber: Send + Sync {
/// Registers a handler to invoke for messages that have been published to a given topic.
Expand Down
4 changes: 4 additions & 0 deletions src/communication/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::{UCode, UStatus, UUri};
use super::{CallOptions, UPayload};

/// An error indicating a problem with invoking a (remote) service operation.
// [impl->req~up-language-comm-api~1]
#[derive(Clone, Error, Debug)]
pub enum ServiceInvocationError {
/// Indicates that the calling uE requested to add/create something that already exists.
Expand Down Expand Up @@ -137,6 +138,7 @@ impl From<ServiceInvocationError> for UStatus {
/// Please refer to the
/// [Communication Layer API specification](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-l2/api.adoc)
/// for details.
// [impl->req~up-language-comm-api~1]
#[cfg_attr(test, automock)]
#[async_trait]
pub trait RpcClient: Send + Sync {
Expand Down Expand Up @@ -210,6 +212,7 @@ impl dyn RpcClient {

/// A handler for processing incoming RPC requests.
///
// [impl->req~up-language-comm-api~1]
#[cfg_attr(test, automock)]
#[async_trait]
pub trait RequestHandler: Send + Sync {
Expand Down Expand Up @@ -243,6 +246,7 @@ pub trait RequestHandler: Send + Sync {
/// Please refer to the
/// [Communication Layer API specification](https://github.com/eclipse-uprotocol/up-spec/blob/main/up-l2/api.adoc)
/// for details.
// [impl->req~up-language-comm-api~1]
#[async_trait]
pub trait RpcServer {
/// Registers an endpoint for RPC requests.
Expand Down
1 change: 1 addition & 0 deletions src/utransport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub trait LocalUriProvider: Send + Sync {
///
/// Please refer to the [uProtocol Transport Layer specification](https://github.com/eclipse-uprotocol/up-spec/blob/v1.6.0-alpha.3/up-l1/README.adoc)
/// for details.
// [impl->req~up-language-transport-api~1]
#[cfg_attr(test, automock)]
#[async_trait]
pub trait UListener: Send + Sync {
Expand Down