summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_api/examples
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-05-31 11:28:43 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-05-31 11:33:45 +0200
commit717c928f7976b3812a77018546e697dd951994b4 (patch)
tree3ace517c18d290da8cf710a2fad66613d8e382fc /crates/core/tedge_api/examples
parenteef2e00b3de89a2a159066edf6faede3698dc1af (diff)
parent3dc51be974294fafa60c9b73280b9be241277765 (diff)
Merge remote-tracking branch 'gitlab-marcel/feature/add_tedge_api_only' into feature/add_tedge_api/integrate-api-changes
This merges the latest changes in the API, which features (mainly) the type-uuid changes from commit 02bfa3768be59b211daddd9b66203b787fd72153 ("Add TypeUUID to Messages"). This merge is done onto the integration branch, so we can adapt to the new API in the next few commits and then merge the integration branch back into the implementation. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
Diffstat (limited to 'crates/core/tedge_api/examples')
-rw-r--r--crates/core/tedge_api/examples/heartbeat.rs11
-rw-r--r--crates/core/tedge_api/examples/universal_log.rs11
2 files changed, 14 insertions, 8 deletions
diff --git a/crates/core/tedge_api/examples/heartbeat.rs b/crates/core/tedge_api/examples/heartbeat.rs
index 454be2ea..911f479b 100644
--- a/crates/core/tedge_api/examples/heartbeat.rs
+++ b/crates/core/tedge_api/examples/heartbeat.rs
@@ -4,23 +4,26 @@ use async_trait::async_trait;
use futures::FutureExt;
use tedge_api::{
address::ReplySenderFor,
- message::MessageType,
- plugin::{AcceptsReplies, BuiltPlugin, Handle, Message, PluginDeclaration, PluginExt},
+ message::{AcceptsReplies, Message, MessageType},
+ plugin::{BuiltPlugin, Handle, PluginDeclaration, PluginExt},
Address, CancellationToken, Plugin, PluginBuilder, PluginConfiguration, PluginDirectory,
PluginError,
};
use tokio::sync::RwLock;
+use type_uuid::TypeUuid;
+#[derive(Debug, TypeUuid)]
+#[uuid = "94916be9-17ba-4bca-a3a0-408d33136fed"]
/// A message that represents a heartbeat that gets sent to plugins
-#[derive(Debug)]
struct Heartbeat;
impl Message for Heartbeat {}
impl AcceptsReplies for Heartbeat {
type Reply = HeartbeatStatus;
}
+#[derive(Debug, TypeUuid)]
+#[uuid = "a6d03c65-51bf-4f89-b383-c67c9ed8533b"]
/// The reply for a heartbeat
-#[derive(Debug)]
enum HeartbeatStatus {
Alive,
Degraded,
diff --git a/crates/core/tedge_api/examples/universal_log.rs b/crates/core/tedge_api/examples/universal_log.rs
index 82ff3130..064ffa22 100644
--- a/crates/core/tedge_api/examples/universal_log.rs
+++ b/crates/core/tedge_api/examples/universal_log.rs
@@ -4,19 +4,22 @@ use async_trait::async_trait;
use futures::FutureExt;
use tedge_api::{
address::ReplySenderFor,
- message::{AnyMessage, MessageType},
- plugin::{AnyMessages, BuiltPlugin, Handle, Message, PluginDeclaration, PluginExt},
+ message::{AnyMessage, Message, MessageType},
+ plugin::{AnyMessages, BuiltPlugin, Handle, PluginDeclaration, PluginExt},
Address, CancellationToken, Plugin, PluginBuilder, PluginConfiguration, PluginDirectory,
PluginError,
};
use tokio::sync::RwLock;
+use type_uuid::TypeUuid;
/// A message that represents a heartbeat that gets sent to plugins
-#[derive(Debug)]
+#[derive(Debug, TypeUuid)]
+#[uuid = "1f807f7b-888f-4881-a1b5-16380e32f8c2"]
struct Heartbeat;
impl Message for Heartbeat {}
-#[derive(Debug)]
+#[derive(Debug, TypeUuid)]
+#[uuid = "346e233f-c24a-47e0-a15b-3ec0d1e19019"]
struct RandomData;
impl Message for RandomData {}