diff options
author | Matthias Beyer <matthias.beyer@ifm.com> | 2022-05-13 19:49:18 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@ifm.com> | 2022-05-17 11:09:53 +0200 |
commit | 3b315ce85d10c5a4ac05b18c5dea4725fa455844 (patch) | |
tree | 1545b2a4238e45faeeec0dbb8a8c4aeca0c4f628 | |
parent | c2b8dd81a9ab2554ffacda1bbedbabd62d10ffc9 (diff) |
Add responsibility of tedge_core documentation in README
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r-- | crates/core/tedge_core/README.md | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/crates/core/tedge_core/README.md b/crates/core/tedge_core/README.md index caf460a6..872da34b 100644 --- a/crates/core/tedge_core/README.md +++ b/crates/core/tedge_core/README.md @@ -9,3 +9,57 @@ orchestrate the running of the individual components of thin-edge.io, called This crate can then be used in a very minimal CLI implementation to start up a process and run all the domain specific parts of thin-edge.io. + +## Responsibilities of this crate + +This crate has several responsibilities: + +* Reading and parsing the configuration of thin-edge.io +* Using the PluginBuilders to instantiate the individual plugins + * with their respective configuration + * giving them the opportunity to retrieve addresses of other plugins, to be + able to send messages to those +* Start the instantiated plugins +* Ensure that messages are passed concurrently between plugins +* Shutting of the running plugins + +All of the above is done with crash-safety in mind. So if one plugin crashes in +either `start`, during the handling of a message or in `shutdown`, this must +never impact other running plugins or the rest of the application. + +With a very high abstraction level, the crate approximately does the following +(although many things in here are executed completely asynchronously and some +details are missing): + +```mermaid +sequenceDiagram + thinedge->>thinedge : load_config() + + thinedge->>+PluginDirectory: new(config) + thinedge->>+PluginBuilder : new() + + thinedge->>thinedge : compute_plugin_specific_config() + + thinedge->>+PluginBuilder : instantiate(plugin_config, plugin_directory) + PluginBuilder->>+PluginDirectory : get_address_for(plugin_config.some_address) + PluginDirectory->>-PluginBuilder: Address + PluginBuilder->>+Plugin : new(Address) + deactivate PluginBuilder + + rect rgb(230, 230, 230) + note right of thinedge: Plugin lifecycle, async for all plugins + + thinedge-->>Plugin : start() + Plugin-->>thinedge : + loop Plugin mainloop + thinedge-->>Plugin : handle_message() + end + thinedge->>Plugin : shutdown() + Plugin-->>thinedge : + deactivate Plugin + end + + deactivate PluginDirectory + deactivate PluginBuilder +``` + |