From eba69be700f50d0326f87cc4597379e801e74557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Cardoso?= Date: Mon, 16 Sep 2024 18:12:06 -0300 Subject: [PATCH] src: hub: Add hub messages stats pub interface --- src/hub/mod.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/hub/mod.rs b/src/hub/mod.rs index af1c67a6..63b90cca 100644 --- a/src/hub/mod.rs +++ b/src/hub/mod.rs @@ -12,7 +12,10 @@ use tokio::sync::{broadcast, mpsc, oneshot, RwLock}; use crate::{ drivers::{Driver, DriverInfo}, protocol::Protocol, - stats::driver::{AccumulatedDriverStats, AccumulatedStatsInner}, + stats::{ + driver::{AccumulatedDriverStats, AccumulatedStatsInner}, + messages::AccumulatedHubMessagesStats, + }, }; use actor::HubActor; @@ -103,6 +106,17 @@ impl Hub { Ok(res) } + pub async fn hub_messages_stats(&self) -> Result { + let (response_tx, response_rx) = oneshot::channel(); + self.sender + .send(HubCommand::GetHubMessagesStats { + response: response_tx, + }) + .await?; + let res = response_rx.await?; + Ok(res) + } + pub async fn reset_all_stats(&self) -> Result<()> { let (response_tx, response_rx) = oneshot::channel(); self.sender