summaryrefslogtreecommitdiffstats
path: root/crates/core
AgeCommit message (Collapse)Author
2022-08-30Update Plugin descriptionpost-merge/api-readme-fixesMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Update PluginBuilder descriptionMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Make wording more explicit on what is verified and startedMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Remove trailing whitespaceMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Fix typo: it's -> itsMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Streamline name to "thin-edge.io"Matthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Merge branch 'feature/add_tedge_api_impl' into integrate-feature-apiintegrate-feature-apiMatthias Beyer
This merge now introduces the "core" library, a CLI implementation, a helper library for simplifying some plugin implementation as well as a number of example plugins. The following message can help you understanding the ideas and concepts that are introduced with this merge as well as help to answer some questions that might arise when reviewing the changeset. In the previous merge we introduced the API. This API does _only_ define an interface how thin-edge.io plugins can be written in a way so they can be used within the thin-edge.io ecosystem. For more information, have a look at the merge commit where the API was introduced. This merge now introduces a list of crates of different importance. I will quickly introduce them here, with only some short notes. More is written in the `README.md` file of the respective crate. * `tedge_core` - The implementation of the part of thin-edge.io, that runs the plugins which implement the `tedge_api` * Ensures composability via configuration with fail-early mechanisms if configuration is faulty * Runs plugins concurrently on multiple cores without spending much time itself * Implements high-performance asynchronous and typed message passing without serialization/deserialization overhead * Ensures plugin lifecycle with panic-catching in all phases of the lifecycle of a plugin * Features fine-grained `tracing` output to be able to make use of the excellent `tracing` ecosystem and enabling detailed performance analytics * Ensures proper plugin shutdown in case of application shutdown * If a plugin does not shutdown after a certain configurable timeout, the plugin will be killed * High testability! The core is tested for several things, for example: * whether a plugin does panic in any phase of it's lifecycle, so that the core does not crash if it happens * whether a plugin does shutdown cleanly * whether application startup is aborted properly if plugins are wired up that are not compatible (`Plugin A` wants to send `Message M` to `Plugin B`, but `Plugin B` only supports `Message X`) * `tedge-cli` - one possible implementation of the CLI for starting a thin-edge.io process. This implementation is not really big, which is definitively intended * Implements easy to use CLI interface * Setup of stdout/chrome/Tracy tracing output * Ties together the core and the plugins * `tedge_lib` - A helper library for helping plugin authors with some recurring aspects/patterns in a plugin implementation * Mainloop abstraction helper for "ticking" mainloop * Mainloop abstraction for stateful `loop{}`-style mainloops * Defines common message types, e.g.: * `Measurement` (just a mockup for now, details have to discussed later) * `Notification` (just a mockup for now, details have to discussed later) * Defines config helper types for more typing in the configuration * Defines address helper types for more convenience over the basics of message passing * A list of example plugin implementations of different complexity * `plugin_avg` - A plugin that calculates an average value from a stream of measurements sent to it. This is a good example plugin for learning how a plugin implementation could look like * `plugin_log` - A plugin that logs all messages sent to it. This is intentionally minimal and does not serve a real purpose * `plugin_httpstop` - A plugin that tells thin-edge.io to stop if a web request was made to a certain endpoint. In short: `curl localhost:8080` to shutdown thin-edge.io. This would also be a good example for reviewing how a basic plugin implementation would look like * `plugin_inotify` - A plugin that watches some files with inotify and sends notification messages if inotify raises an event. This is a good example of a bit more involved plugin * `plugin_measurement_filter` - A plugin to filter `Measurement` messages by a user-defined predicate. Think "Ignore all measurements below value `12`" * `plugin_mqtt` - A way for connecting thin-edge.io with an MQTT broker. This plugin does not parse MQTT payloads, which is done by another plugin, depending on the usecase that one wants to cover. Instead it only contains the MQTT handling, so that other plugins do not have to care about the transport mechanisms their payloads are sent/received with * `plugin_mqtt_measurement_bridge` - A plugin that receives `Measurement` objects, serializes them to JSON and sends them to an MQTT Plugin. This is another building block in an MQTT setup and makes the serialization method decoupled from the business logic that emits `Measurement` objects. * `plugin_sysstat` - A plugin that uses the `sysinfo` crate to get system statistics and sends them as `Measurement` messages. This is a really involved plugin (code-size wise) and might require some more effort to understand. We did not yet introduce plugins for things like collectd, systemd, apt, and so on in this work, as these are clearly _usecases_ and we want to keep the plugin implementations we provide in this PR in the "this is an example" space. The work merged with this commit does not claim to provide the end-result of anything! This is code, it can and most certainly will be changed after this is merged to the `main` branch. The most stable part of this PR is the `tedge_core` crate. The plugins are only examples! There are also some types defined for representing a `Measurement` for example. This is not final by any means and its purpose is to be able to implement example plugins! Of course we have to iterate on how a Measurement (e.g.) should and can look like! The existing types for representing a `Measurement` were not used in this PR because of development-workflow reasons. All changes that are merged with this commit are made under the DCO and _not_ under any CLA. DCO: Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: Marcel Müller <m.mueller@ifm.com> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Merge 'feature/add_tedge_api_only' into integrate-feature-apiMatthias Beyer
This merge introduces the thin-edge.io API definition to the codebase. The merge is done to an integration-branch because of the longevity of the `feature/add_tedge_api_only` branch, which branched off of `main` in February 2022. Because of the long development time, `Cargo.lock` has now conflicts. We cannot rebase the feature branch anymore, as it would only be effort that can be prevented by an integration branch such as this. So, here we introduce the API. This API does _only_ define an interface how thin-edge.io plugins can be written in a way so they can be used within the thin-edge.io ecosystem. That means, by using this API, a plugin author gets the following things for free (these are high-level bullet points): * Running their plugin concurrently to other components/plugins of thin-edge.io * Sending messages to other components of thin-edge.io * These messages are typed. This means that they are normal rust objects. A plugin author does not have to concern themselves with serialization and deserialization of messages, as there is none * Message passing is lightweight, no external processes are needed and sending tons (literally thousands) of messages is not a problem * Receiving messages from other components of thin-edge.io * Concurrently * handling them in an asynchronous way * without de/serialization overhead * Safety from crashes. If a plugin crashes, it does not bring down the rest of the application. All other plugins continue to run * Compatibility of components is a compiletime assurance! * A clear shutdown path, if a shutdown was requested for the application Besides these rather technical points, we get the following (very high level) benefits: * Error handling is uniform and streamlined. Providing excellent error messages to the user is a matter of writing down good error messages, not of implementing good error handling * Logging is uniform over all components of the software * Tracing how a message propagated through the software is easily doable, as only one process is involved and the excellent `tracing` ecosystem provides the heavy lifting for us * runtime performance analytics a developer might want to do is easy with `tracing` as well * High performance is ensured via the `tokio` runtime, having tons of tasks running in a concurrent way is handled by the runtime, a developer has not to concern themselves with it All changes that are merged with this commit are made under the DCO and _not_ under any CLA. DCO: Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: Marcel Müller <m.mueller@ifm.com> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-30Move alarms converter code to a separate file (#1366)PradeepKiruvale
* Move c8y alarms converter code to a separate file Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-08-22Add manifest fields to all crates in meta-tedgeMarcel Guzik
Add `homepage` and `manifest` fields in `Cargo.toml`s of crates used in meta-tedge so that cargo-bitbake utility can generate recipe files for them. Signed-off-by: Marcel Guzik <marcel.guzik2@inetum.com>
2022-08-19Merge pull request #1348 from thin-edge/create-pull-request/patchAlbin Suresh
Patch version bump
2022-08-18Merge pull request #1349 from matthiasbeyer/clippy-fixesDidier Wenzek
Clippy fixes
2022-08-18Merge pull request #1279 from matthiasbeyer/remove-let-unitDidier Wenzek
Clippy: Remove let unit
2022-08-18Merge pull request #1338 from ↵initard
initard/feature/1070/tedge-agent-log-directory-path-configurable make log directory configurable during init
2022-08-18Fix clippy: Remove unnecessary .to_string()Matthias Beyer
This fixes clippy::unnecessary_to_owned Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: thin_edge_json: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: tedge_mapper: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: tedge_agent: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: tedge: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: c8y_translator: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: c8y_smartrest: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: c8y_api: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy: agent_interface: Add derive for EqMatthias Beyer
This fixes clippy::derive_partial_eq_without_eq Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18make log directory configurable during initinitard
* the log directory configured in tedge config set logs.path is now used in --init Signed-off-by: initard <alex.solomes@softwareag.com>
2022-08-18Fix clippy in thin_edge_json: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in tedge_mapper: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in tedge_agent: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in tedge: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in plugin_sm: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in c8y_translator: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in c8y_smartrest: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Fix clippy in c8y_api: Remove let-unit-valueMatthias Beyer
This patch fixes `clippy::let_unit_value`. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-18Restart of tedge-mapper-c8y is recreating deleted child devices (#1344)PradeepKiruvale
* Create external device only after alarm message sync Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-08-18(cargo release) bump versionVersioneer
2022-08-17Merge pull request #1330 from Bravo555/add-homepage-fieldDidier Wenzek
Yocto: Add homepage and repository fields to manifests of tedge and tedge_mapper crates
2022-08-16Merge pull request #1318 from matthiasbeyer/tedge-watchdog/systemd-only-on-linuxDidier Wenzek
Make systemd watchdog backend only build for linux
2022-08-16Make systemd watchdog backend only build for linuxMatthias Beyer
This patch ensures that the systemd watchdog backend is only used when building for linux. Right now, there is no other watchdog implementation. Thus, there is a "dummy_watchdog" module introduced that does nothing. This might be removed and replaced by something specific, if we ever build thin-edge.io for other targets, such as Apple, FreeBSD or others. Suggested-by: Albin Suresh <albin.suresh@softwareag.com> Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-11Add homepage and repository fields to manifests of tedge and tedge_mapper cratesMarcel Guzik
This change is necessary to generate bitbake recipes from tedge and tedge_mapper crates as part of #1329. Currently, we're trying to set up a minimal working example, and as such only these crates required this change. Signed-off-by: Marcel Guzik <marcel.guzik2@inetum.com>
2022-08-10Fix: Add missing featuresfeature/add_tedge_api_implMatthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-08tedge_mapper: Remove let _ =Matthias Beyer
These were introduced in 098cd1bc0b8a5fb46d114733c5f5c632fc25587e ("Alarms for child devices (#1314)") from pull request #1314 where my review comments were not fixed, so I'm gonna fix these here. Fixes: 098cd1bc0b8a5fb46d114733c5f5c632fc25587e ("Alarms for child devices (#1314)") Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-08c8y_translator: Remove unnecessary let _ =Matthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-08tedge: Remove unnecessary let _ =Matthias Beyer
Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-08-08Alarms for child devices (#1314)PradeepKiruvale
With this feature the child device now able to send an alarm message to Cumulocity cloud. The child device must use the mqtt topic to publish the alarm message, then thin-edge device will pickup this alarm message and forward it to the cumulocity cloud. Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-08-06Do not necessarily pass &str anymore to fs helper fnsMatthias Beyer
This patch changs the calls of the fs helper functions where the interface of the functions was changed from taking `&str` as path argument to `impl AsRef<Path>`. Because of this, it is not necessary anymore that `&str` is passed, but `Path`es can be passed or, as in most cases, the ad-hoc created `String` objects can be passed by value instead of by reference, resulting in less mental load on the calling side. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-07-29MQTT health endpoints for tedge plugin extensions (#1299)PradeepKiruvale
* tedge watchdog for c8y-log-plugin and c8y-config-plugin This PR also refactors the health check by removing the duplicate code. Pushed the duplicate code to one place and reused it across all the thin-edge services. Signed-off-by: Pradeep Kumar K J <pradeepkumar.kj@softwareag.com>
2022-07-26Merge pull request #1298 from matthiasbeyer/remove-clock-serdeDidier Wenzek
Remove "serde" module in "clock" crate
2022-07-26Replace clock serde functionality with time serde functionalityMatthias Beyer
The serde module from the "clock" crate was only a reexport of the serde module of the "time" crate, so we can simply use the latter here. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
2022-07-26Merge pull request #1250 from ↵initard
initard/improvement/1173/inotify-tedge-mapper-dynamic-discovery-of-operations tedge mapper dynamic discovery of operations
2022-07-25implementing fs-notify crate for dynamic discovery of operationsinitard
Signed-off-by: initard <solo@softwareag.com>
2022-07-25Bump serial_test from 0.6.0 to 0.8.0dependabot[bot]
Bumps [serial_test](https://github.com/palfrey/serial_test) from 0.6.0 to 0.8.0. - [Release notes](https://github.com/palfrey/serial_test/releases) - [Commits](https://github.com/palfrey/serial_test/compare/v0.6.0...v0.8.0) --- updated-dependencies: - dependency-name: serial_test dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>