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 17, 2024
1 parent eb83a0a commit d92b449
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::accumulated::{driver::AccumulatedDriverStats, AccumulatedStatsInner},
stats::accumulated::{
driver::AccumulatedDriverStats, messages::AccumulatedHubMessagesStats,
AccumulatedStatsInner,
},
};

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 d92b449

Please sign in to comment.