diff options
Diffstat (limited to 'rust/scraper/src/hub/mod.rs')
-rw-r--r-- | rust/scraper/src/hub/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rust/scraper/src/hub/mod.rs b/rust/scraper/src/hub/mod.rs new file mode 100644 index 0000000..0720f7c --- /dev/null +++ b/rust/scraper/src/hub/mod.rs @@ -0,0 +1,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>, +} |