summaryrefslogtreecommitdiff
path: root/rust/scraper/src/hub/mod.rs
blob: 0720f7c85871d9c24e6c43de44beea05b03d82c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use lapin::message::Delivery;
use tokio::sync::mpsc::Receiver;
use proto::touchpad::common::v1;
use crate::TouchpadLiveClient;

#[async_trait::async_trait]
pub trait Output {
    async fn add_swimmer(&self, swimmer: &v1::Swimmer) -> Result<(), Box<dyn std::error::Error>>;
    async fn add_team(&self, team: &v1::Team) -> Result<(), Box<dyn std::error::Error>>;
    async fn add_meet(&self, meet: &v1::SwimMeet) -> Result<(), Box<dyn std::error::Error>>;
    async fn upsert_event(&self, event: &v1::Event) -> Result<(), Box<dyn std::error::Error>>;
}

pub struct Hub<'a> {
    source: TouchpadLiveClient<'a>,
    outputs: Vec<Box<dyn Output>>,
    messages: Receiver<Delivery>,
}