From 5ade2a008bded8fa3a9b26fcbf77833f764b8cc2 Mon Sep 17 00:00:00 2001 From: xsanm Date: Wed, 18 Oct 2023 18:16:01 +0200 Subject: [PATCH] [Tunnelbroker] improve Tunnelbroker messages docs Summary: - Addresses: https://phab.comm.dev/D9463?id=31961#inline-59838 - Fix typos - Fix file name Test Plan: N/A Reviewers: michal, bartek, varun, jon Reviewed By: michal Subscribers: ashoat, tomek, wyilio Differential Revision: https://phab.comm.dev/D9521 --- services/tunnelbroker/src/websockets/session.rs | 5 +++-- shared/tunnelbroker_messages/src/lib.rs | 2 +- shared/tunnelbroker_messages/src/messages/keys.rs | 2 +- .../src/messages/message_to_device.rs | 2 +- .../src/messages/message_to_device_request.rs | 2 +- ...confirmation.rs => message_to_device_request_status.rs} | 4 ++-- shared/tunnelbroker_messages/src/messages/mod.rs | 7 ++++--- shared/tunnelbroker_messages/src/messages/session.rs | 6 +++--- 8 files changed, 16 insertions(+), 14 deletions(-) rename shared/tunnelbroker_messages/src/messages/{send_confirmation.rs => message_to_device_request_status.rs} (95%) diff --git a/services/tunnelbroker/src/websockets/session.rs b/services/tunnelbroker/src/websockets/session.rs index fdc65b1b35..3258a419cd 100644 --- a/services/tunnelbroker/src/websockets/session.rs +++ b/services/tunnelbroker/src/websockets/session.rs @@ -16,8 +16,9 @@ use tokio::io::AsyncRead; use tokio::io::AsyncWrite; use tracing::{debug, error, info}; use tunnelbroker_messages::{ - send_confirmation::Failure, send_confirmation::MessageSentStatus, - session::DeviceTypes, MessageToDeviceRequest, Messages, + message_to_device_request_status::Failure, + message_to_device_request_status::MessageSentStatus, session::DeviceTypes, + MessageToDeviceRequest, Messages, }; use crate::database::{self, DatabaseClient, DeviceMessage}; diff --git a/shared/tunnelbroker_messages/src/lib.rs b/shared/tunnelbroker_messages/src/lib.rs index 14d04d641e..5a81ba56b4 100644 --- a/shared/tunnelbroker_messages/src/lib.rs +++ b/shared/tunnelbroker_messages/src/lib.rs @@ -1,4 +1,4 @@ pub mod messages; +pub use message_to_device_request_status::*; pub use messages::*; -pub use send_confirmation::*; diff --git a/shared/tunnelbroker_messages/src/messages/keys.rs b/shared/tunnelbroker_messages/src/messages/keys.rs index 911ada168e..c2f5ab779a 100644 --- a/shared/tunnelbroker_messages/src/messages/keys.rs +++ b/shared/tunnelbroker_messages/src/messages/keys.rs @@ -1,4 +1,4 @@ -// Messages sent between Tunnelbroker and a device +//! Messages sent from Tunnelbroker to a device. use serde::{Deserialize, Serialize}; diff --git a/shared/tunnelbroker_messages/src/messages/message_to_device.rs b/shared/tunnelbroker_messages/src/messages/message_to_device.rs index 312baddd00..31f39ab518 100644 --- a/shared/tunnelbroker_messages/src/messages/message_to_device.rs +++ b/shared/tunnelbroker_messages/src/messages/message_to_device.rs @@ -1,4 +1,4 @@ -// Messages sent between Tunnelbroker and a device via WebSocket +//! Messages sent between Tunnelbroker and a device via WebSocket. use serde::{Deserialize, Serialize}; diff --git a/shared/tunnelbroker_messages/src/messages/message_to_device_request.rs b/shared/tunnelbroker_messages/src/messages/message_to_device_request.rs index 1138824e6b..cc92e67291 100644 --- a/shared/tunnelbroker_messages/src/messages/message_to_device_request.rs +++ b/shared/tunnelbroker_messages/src/messages/message_to_device_request.rs @@ -1,4 +1,4 @@ -// Message sent from WebSocket clients to Tunnelbroker +//! Message sent from Tunnelbroker to WebSocket. use serde::{Deserialize, Serialize}; diff --git a/shared/tunnelbroker_messages/src/messages/send_confirmation.rs b/shared/tunnelbroker_messages/src/messages/message_to_device_request_status.rs similarity index 95% rename from shared/tunnelbroker_messages/src/messages/send_confirmation.rs rename to shared/tunnelbroker_messages/src/messages/message_to_device_request_status.rs index 9e33cd1809..bd77e3f40b 100644 --- a/shared/tunnelbroker_messages/src/messages/send_confirmation.rs +++ b/shared/tunnelbroker_messages/src/messages/message_to_device_request_status.rs @@ -1,5 +1,5 @@ -// Message sent from Tunnelbroker to WebSocket clients to inform that message -// was processed, saved in DDB and will be delivered. +//! Message sent from Tunnelbroker to WebSocket clients to inform that message +//! was processed, saved in DDB, and will be delivered. use serde::{Deserialize, Serialize}; diff --git a/shared/tunnelbroker_messages/src/messages/mod.rs b/shared/tunnelbroker_messages/src/messages/mod.rs index d18ef0963d..27c3b43284 100644 --- a/shared/tunnelbroker_messages/src/messages/mod.rs +++ b/shared/tunnelbroker_messages/src/messages/mod.rs @@ -1,14 +1,15 @@ -// Messages sent between Tunnelbroker and a device +//! Messages sent between Tunnelbroker and a device. + pub mod keys; pub mod message_to_device; pub mod message_to_device_request; -pub mod send_confirmation; +pub mod message_to_device_request_status; pub mod session; pub use keys::*; pub use message_to_device::*; pub use message_to_device_request::*; -pub use send_confirmation::*; +pub use message_to_device_request_status::*; pub use session::*; use serde::{Deserialize, Serialize}; diff --git a/shared/tunnelbroker_messages/src/messages/session.rs b/shared/tunnelbroker_messages/src/messages/session.rs index 0f99d6d69d..e9e5e95197 100644 --- a/shared/tunnelbroker_messages/src/messages/session.rs +++ b/shared/tunnelbroker_messages/src/messages/session.rs @@ -1,12 +1,12 @@ -// Messages sent between Tunnelbroker and a device +//! The first message sent from WebSocket client to Tunnelbroker. use serde::{Deserialize, Serialize}; -/// The workflow when estabilishing a Tunnelbroker connection: +/// The workflow when establishing a Tunnelbroker connection: /// - Client sends ConnectionInitializationMessage /// - Tunnelbroker validates access_token with identity service /// - Tunnelbroker emits an AMQP message declaring that it has opened a new -/// connection with a given device, so that the respective tunnelbroker +/// connection with a given device, so that the respective Tunnelbroker /// instance can close the existing connection. /// - Tunnelbroker returns a session_id representing that the connection was /// accepted