Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve naming for message box builder traits #1748

Merged
merged 3 commits into from
Feb 27, 2023

Conversation

didier-wenzek
Copy link
Contributor

Proposed changes

  • Rename ServiceProvider and ServiceConsumer the former Socket/Plug traits
  • Rename Server the former Service trait
  • Rename ServerMessageBox the former ServiceMessageBox trait
  • Rename ServerClientMessageBox the former RequestResponseHandler struct

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

#1724

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
137 0 5 137 100

Passed Tests

Name ⏱️ Duration Suite
Define Child device 1 ID 0.004 s C8Y Child Alarms Rpi
Normal case when the child device does not exist on c8y cloud 4.795 s C8Y Child Alarms Rpi
Normal case when the child device already exists 1.083 s C8Y Child Alarms Rpi
Reconciliation when the new alarm message arrives, restart the mapper 1.782 s C8Y Child Alarms Rpi
Reconciliation when the alarm that is cleared 5.698 s C8Y Child Alarms Rpi
Prerequisite Parent 18.443 s Child Conf Mgmt Plugin
Prerequisite Child 0.31 s Child Conf Mgmt Plugin
Child device bootstrapping 15.850999999999999 s Child Conf Mgmt Plugin
Snapshot from device 22.011 s Child Conf Mgmt Plugin
Child device config update 19.549 s Child Conf Mgmt Plugin
Configuration types should be detected on file change (without restarting service) 48.945 s Inotify Crate
Child devices support sending simple measurements 50.947 s Child Device Telemetry
Child devices support sending custom measurements 46.793 s Child Device Telemetry
Child devices support sending custom events 39.987 s Child Device Telemetry
Child devices support sending custom events overriding the type 31.883 s Child Device Telemetry
Child devices support sending custom alarms #1699 33.047 s Child Device Telemetry
Child devices support sending inventory data via c8y topic 24.759 s Child Device Telemetry
Main device support sending inventory data via c8y topic 24.257 s Child Device Telemetry
Successful firmware operation 63.176 s Firmware Operation
Install with empty firmware name 50.113 s Firmware Operation
Supports restarting the device 75.997 s Restart Device
Update tedge version from previous using Cumulocity 99.336 s Tedge Self Update
Successful shell command with output 4.421 s Shell Operation
Check Successful shell command with literal double quotes output 3.685 s Shell Operation
Execute multiline shell command 3.407 s Shell Operation
Failed shell command 3.556 s Shell Operation
Software list should be populated during startup 50.111 s Software
Install software via Cumulocity 67.166 s Software
Software list should only show currently installed software and not candidates 40.787 s Software
Stop tedge-agent service 0.188 s Log Path Config
Customize the log path 0.069 s Log Path Config
Initialize tedge-agent 0.147 s Log Path Config
Check created folders 0.089 s Log Path Config
Remove created custom folders 0.09 s Log Path Config
Install latest via script (from current branch) 29.414 s Install Tedge
Install specific version via script (from current branch) 19.744 s Install Tedge
Install latest tedge via script (from main branch) 24.874 s Install Tedge
Support starting and stopping services 38.201 s Service-Control
Supports a reconnect 44.892 s Test-Commands
Supports disconnect then connect 43.59 s Test-Commands
Update unknown setting 28.174 s Test-Commands
Update known setting 22.088 s Test-Commands
Stop c8y-configuration-plugin 0.19 s Health C8Y-Configuration-Plugin
Update the service file 0.192 s Health C8Y-Configuration-Plugin
Reload systemd files 0.679 s Health C8Y-Configuration-Plugin
Start c8y-configuration-plugin 0.161 s Health C8Y-Configuration-Plugin
Start watchdog service 10.29 s Health C8Y-Configuration-Plugin
Check PID of c8y-configuration-plugin 0.118 s Health C8Y-Configuration-Plugin
Kill the PID 0.249 s Health C8Y-Configuration-Plugin
Recheck PID of c8y-configuration-plugin 2.228 s Health C8Y-Configuration-Plugin
Compare PID change 0.001 s Health C8Y-Configuration-Plugin
Stop watchdog service 0.189 s Health C8Y-Configuration-Plugin
Remove entry from service file 0.18 s Health C8Y-Configuration-Plugin
Stop c8y-log-plugin 0.151 s Health C8Y-Log-Plugin
Update the service file 0.173 s Health C8Y-Log-Plugin
Reload systemd files 0.765 s Health C8Y-Log-Plugin
Start c8y-log-plugin 0.209 s Health C8Y-Log-Plugin
Start watchdog service 10.309 s Health C8Y-Log-Plugin
Check PID of c8y-log-plugin 0.085 s Health C8Y-Log-Plugin
Kill the PID 0.107 s Health C8Y-Log-Plugin
Recheck PID of c8y-log-plugin 2.137 s Health C8Y-Log-Plugin
Compare PID change 0.001 s Health C8Y-Log-Plugin
Stop watchdog service 0.061 s Health C8Y-Log-Plugin
Remove entry from service file 0.07 s Health C8Y-Log-Plugin
Stop tedge-mapper 0.189 s Health Tedge Mapper C8Y
Update the service file 0.191 s Health Tedge Mapper C8Y
Reload systemd files 0.664 s Health Tedge Mapper C8Y
Start tedge-mapper 0.197 s Health Tedge Mapper C8Y
Start watchdog service 10.184 s Health Tedge Mapper C8Y
Check PID of tedge-mapper 0.056 s Health Tedge Mapper C8Y
Kill the PID 0.061 s Health Tedge Mapper C8Y
Recheck PID of tedge-mapper 2.162 s Health Tedge Mapper C8Y
Compare PID change 0.001 s Health Tedge Mapper C8Y
Stop watchdog service 0.105 s Health Tedge Mapper C8Y
Remove entry from service file 0.078 s Health Tedge Mapper C8Y
Stop tedge-agent 0.172 s Health Tedge-Agent
Update the service file 0.125 s Health Tedge-Agent
Reload systemd files 0.447 s Health Tedge-Agent
Start tedge-agent 0.118 s Health Tedge-Agent
Start watchdog service 10.268 s Health Tedge-Agent
Check PID of tedge-mapper 0.08 s Health Tedge-Agent
Kill the PID 0.079 s Health Tedge-Agent
Recheck PID of tedge-agent 2.162 s Health Tedge-Agent
Compare PID change 0 s Health Tedge-Agent
Stop watchdog service 0.138 s Health Tedge-Agent
Remove entry from service file 0.187 s Health Tedge-Agent
Stop tedge-mapper-az 0.173 s Health Tedge-Mapper-Az
Update the service file 0.193 s Health Tedge-Mapper-Az
Reload systemd files 0.358 s Health Tedge-Mapper-Az
Start tedge-mapper-az 0.147 s Health Tedge-Mapper-Az
Start watchdog service 10.221 s Health Tedge-Mapper-Az
Check PID of tedge-mapper-az 0.166 s Health Tedge-Mapper-Az
Kill the PID 0.143 s Health Tedge-Mapper-Az
Recheck PID of tedge-agent 2.179 s Health Tedge-Mapper-Az
Compare PID change 0.001 s Health Tedge-Mapper-Az
Stop watchdog service 0.162 s Health Tedge-Mapper-Az
Remove entry from service file 0.117 s Health Tedge-Mapper-Az
Stop tedge-mapper-collectd 0.253 s Health Tedge-Mapper-Collectd
Update the service file 0.196 s Health Tedge-Mapper-Collectd
Reload systemd files 0.604 s Health Tedge-Mapper-Collectd
Start tedge-mapper-collectd 0.132 s Health Tedge-Mapper-Collectd
Start watchdog service 10.246 s Health Tedge-Mapper-Collectd
Check PID of tedge-mapper-collectd 0.128 s Health Tedge-Mapper-Collectd
Kill the PID 0.163 s Health Tedge-Mapper-Collectd
Recheck PID of tedge-mapper-collectd 2.321 s Health Tedge-Mapper-Collectd
Compare PID change 0.001 s Health Tedge-Mapper-Collectd
Stop watchdog service 0.203 s Health Tedge-Mapper-Collectd
Remove entry from service file 0.127 s Health Tedge-Mapper-Collectd
c8y-log-plugin health status 5.851 s MQTT health endpoints
c8y-configuration-plugin health status 5.711 s MQTT health endpoints
Wrong package name 0.172 s Improve Tedge Apt Plugin Error Messages
Wrong version 0.197 s Improve Tedge Apt Plugin Error Messages
Wrong type 0.269 s Improve Tedge Apt Plugin Error Messages
tedge_connect_test_positive 0.488 s Tedge Connect Test
tedge_connect_test_negative 0.366 s Tedge Connect Test
tedge_connect_test_sm_services 7.321 s Tedge Connect Test
tedge_disconnect_test_sm_services 0.365 s Tedge Connect Test
Install thin-edge.io 14.174 s Call Tedge
call tedge -V 0.345 s Call Tedge
call tedge -h 0.273 s Call Tedge
call tedge -h -V 0.295 s Call Tedge
call tedge help 0.157 s Call Tedge
tedge config list 0.118 s Call Tedge Config List
tedge config list --all 0.102 s Call Tedge Config List
set/unset device.type 0.46 s Call Tedge Config List
set/unset device.key.path 0.716 s Call Tedge Config List
set/unset device.cert.path 0.549 s Call Tedge Config List
set/unset c8y.root.cert.path 0.756 s Call Tedge Config List
set/unset c8y.smartrest.templates 0.481 s Call Tedge Config List
set/unset az.root.cert.path 0.415 s Call Tedge Config List
set/unset az.mapper.timestamp 0.389 s Call Tedge Config List
set/unset mqtt.bind_address 0.24 s Call Tedge Config List
set/unset mqtt.port 0.25 s Call Tedge Config List
set/unset tmp.path 0.251 s Call Tedge Config List
set/unset logs.path 0.241 s Call Tedge Config List
set/unset run.path 0.272 s Call Tedge Config List
Get Put Delete 3.575 s Http File Transfer Api

Copy link
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the biggest fan of the name Server as that still sounds a bit too broad. But, still approving as I'm unable to come up with something better.

@@ -341,22 +341,22 @@ impl<Request: Message, Response: Message> MessageBox
/// Client side handler of requests/responses sent to an actor
///
/// Note that this message box sends requests and receive responses.
pub struct RequestResponseHandler<Request, Response> {
pub struct ServerClientMessageBox<Request, Response> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just ClientMessageBox ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, an option I considered. I tried to keep the Server prefix. But, you are correct, ClientMessageBox is simpler => I will do the change before merging.

- The terms Socket and Plug failed to convey the intent of these two traits.
- ServiceProvider stresses that an actor, which builder implements that trait,
  provides a service that can be used by other actors.
- ServiceConsumer is the trait to be implemented by the builder on an
  actor that use a service provider by an other.

Alternatives that have been considered:
- FeatureProvider and FeatureConsumer
- Adding a Builder suffix as these traits are to be implemented by builders
- Adding a Connector suffix as these traits are used to connect actors.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
This is to avoid confusion with ServiceProvider and ServiceConsumer
that are implemented by actors that don't act as servers
i.e. with a protocol that is not necessarily a request/response protocol.

Renaming:
- ServiceMessageBox -> ServerMessageBox
- ServiceMessageBoxBuilder -> ServerMessageBoxBuilder
- RequestResponseHandler -> ClientMessageBox

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
To avoid confusion with ServiceConsumer and ServiceProvider.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
@didier-wenzek didier-wenzek temporarily deployed to Test Pull Request February 27, 2023 14:08 — with GitHub Actions Inactive
@didier-wenzek didier-wenzek merged commit 10c86d0 into thin-edge:main Feb 27, 2023
@didier-wenzek didier-wenzek deleted the refactor/improve-naming branch February 27, 2023 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants