summaryrefslogtreecommitdiffstats
path: root/crates/core/tedge_api/examples
diff options
context:
space:
mode:
authorMarcel Müller <m.mueller@ifm.com>2022-04-13 09:53:55 +0200
committerMarcel Müller <m.mueller@ifm.com>2022-04-13 09:53:55 +0200
commitcb823b72c1c64646db4cbc4d4631b9d3885efb3c (patch)
treec5efb53f5815b8744c6f660e88bb44d05859e28f /crates/core/tedge_api/examples
parent8697a6e1e1b579d606b7c07e7fbde54adc6a71af (diff)
Adapt names with documentation to be more fitting
Signed-off-by: Marcel Müller <m.mueller@ifm.com>
Diffstat (limited to 'crates/core/tedge_api/examples')
-rw-r--r--crates/core/tedge_api/examples/heartbeat.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/core/tedge_api/examples/heartbeat.rs b/crates/core/tedge_api/examples/heartbeat.rs
index cb05b4b1..35ac183d 100644
--- a/crates/core/tedge_api/examples/heartbeat.rs
+++ b/crates/core/tedge_api/examples/heartbeat.rs
@@ -9,7 +9,7 @@ use futures::FutureExt;
use tedge_api::{
address::ReplySender,
message::NoReply,
- plugin::{BuiltPlugin, Handle, HandleTypes, Message, PluginDeclaration, PluginExt},
+ plugin::{BuiltPlugin, Handle, Message, PluginDeclaration, PluginExt},
Address, CancellationToken, Plugin, PluginBuilder, PluginConfiguration, PluginDirectory,
PluginError,
};
@@ -45,7 +45,7 @@ impl<PD: PluginDirectory> PluginBuilder<PD> for HeartbeatServiceBuilder {
where
Self: Sized,
{
- HandleTypes::empty()
+ HeartbeatService::get_handled_types()
}
async fn verify_configuration(
@@ -79,7 +79,7 @@ impl<PD: PluginDirectory> PluginBuilder<PD> for HeartbeatServiceBuilder {
monitored_services,
cancellation_token,
)
- .into_untyped())
+ .finish())
}
}
@@ -109,7 +109,7 @@ impl Plugin for HeartbeatService {
///
/// Because this example is _simple_, we do not spawn a background task that periodically sends
/// the heartbeat. In a real world scenario, that background task would be started here.
- async fn setup(&mut self) -> Result<(), PluginError> {
+ async fn start(&mut self) -> Result<(), PluginError> {
println!(
"HeartbeatService: Setting up heartbeat service with interval: {:?}!",
self.interval_duration
@@ -230,7 +230,7 @@ impl<PD: PluginDirectory> PluginBuilder<PD> for CriticalServiceBuilder {
Ok(CriticalService {
status: tokio::sync::Mutex::new(true),
}
- .into_untyped())
+ .finish())
}
}
@@ -271,7 +271,7 @@ impl PluginDeclaration for CriticalService {
/// Because the CriticalService is of course a Plugin, it needs an implementation for that as well.
#[async_trait]
impl Plugin for CriticalService {
- async fn setup(&mut self) -> Result<(), PluginError> {
+ async fn start(&mut self) -> Result<(), PluginError> {
println!("CriticalService: Setting up critical service!");
Ok(())
}
@@ -420,8 +420,8 @@ async fn main() {
let mut heartbeat = build_heartbeat_plugin(&mut comms, cancel_token.child_token()).await;
let mut critical_service = build_critical_plugin(&mut comms, cancel_token.child_token()).await;
- heartbeat.plugin_mut().setup().await.unwrap();
- critical_service.plugin_mut().setup().await.unwrap();
+ heartbeat.plugin_mut().start().await.unwrap();
+ critical_service.plugin_mut().start().await.unwrap();
let mut recv = comms
.plugins