Skip to content

Commit

Permalink
src: hub: Add hub messages stats pub interface
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Sep 16, 2024
1 parent 679a629 commit eba69be
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/hub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -103,6 +106,17 @@ impl Hub {
Ok(res)
}

pub async fn hub_messages_stats(&self) -> Result<AccumulatedHubMessagesStats> {
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
Expand Down

0 comments on commit eba69be

Please sign in to comment.