| b64e2537 Andy McCall ↶ |
1 |
|
| 2 |
|
| 3 |
|
| 4 |
use hub_api::ProposalEvent; |
| 5 |
use tokio::sync::broadcast; |
| 6 |
|
| 7 |
pub struct Events { |
| 8 |
pub deliveries: broadcast::Sender<()>, |
| 9 |
pub proposals: broadcast::Sender<(i64, ProposalEvent)>, |
| 10 |
} |
| 11 |
|
| 12 |
impl Default for Events { |
| 13 |
fn default() -> Self { |
| 14 |
Events { deliveries: broadcast::channel(16).0, proposals: broadcast::channel(256).0 } |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
impl Events { |
| 19 |
pub fn notify_deliveries(&self) { |
| 20 |
let _ = self.deliveries.send(()); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
pub fn proposal(&self, repo_id: i64, event: ProposalEvent) { |
| 25 |
let _ = self.proposals.send((repo_id, event)); |
| 26 |
} |
| 27 |
} |