diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-08-12 19:17:13 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-08-30 13:54:48 +0200 |
commit | eb642c89a9e06adbe915de0d41c99214194ec969 (patch) | |
tree | f0f0b1c8697ded5c33ed3a031dba1a01a23e6246 | |
parent | 1538d70921acbe2e237e2a4f4ae072c8641b544d (diff) |
Add doc for CorePlugin
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | crates/core/tedge_core/src/core_task.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/core/tedge_core/src/core_task.rs b/crates/core/tedge_core/src/core_task.rs index ac009c84..b9441aa2 100644 --- a/crates/core/tedge_core/src/core_task.rs +++ b/crates/core/tedge_core/src/core_task.rs @@ -2,12 +2,19 @@ use async_trait::async_trait; use tedge_api::{address::ReplySenderFor, message::StopCore, plugin::Handle, Plugin, PluginError}; use tracing::trace; -#[derive(Clone)] +/// "Core" Plugin +/// +/// A type that pretends to be a plugin which handles all communication with thin-edge.io itself. +/// This type implements the normal [Plugin](tedge_api::plugin::Plugin) trait so that it can be run +/// like a normal plugin, but has special privileged access to the runtime of thin-edge.io, for +/// example to shut down the application. +/// #[derive(Clone)] pub struct CorePlugin { sender: tokio::sync::mpsc::Sender<CoreInternalMessage>, } impl CorePlugin { + /// Instantiate new CorePlugin pub fn new(sender: tokio::sync::mpsc::Sender<CoreInternalMessage>) -> Self { Self { sender } } @@ -17,6 +24,8 @@ impl tedge_api::plugin::PluginDeclaration for CorePlugin { type HandledMessages = (StopCore,); } +/// Internal message that is sent between the `CorePlugin` shim and the thin-edge.io runtime +/// implementation. pub enum CoreInternalMessage { Stop, } |