added EventSender to FullNode type (#14268)

Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Poulav Bhowmick
2025-02-09 19:34:12 +05:30
committed by GitHub
parent 197d6edee9
commit b48426efdd
6 changed files with 39 additions and 10 deletions

View File

@@ -4,8 +4,8 @@ use tracing::trace;
const DEFAULT_SIZE_BROADCAST_CHANNEL: usize = 2000;
/// A bounded broadcast channel for a task.
#[derive(Debug, Clone)]
/// A bounded multi-producer, multi-consumer broadcast channel.
#[derive(Debug)]
pub struct EventSender<T> {
/// The sender part of the broadcast channel
sender: Sender<T>,
@@ -20,6 +20,12 @@ where
}
}
impl<T> Clone for EventSender<T> {
fn clone(&self) -> Self {
Self { sender: self.sender.clone() }
}
}
impl<T: Clone + Send + Sync + 'static> EventSender<T> {
/// Creates a new `EventSender`.
pub fn new(events_channel_size: usize) -> Self {