rusty_bin/monitor/collector/
traits.rs1use crate::monitor::collector::{
4 error::Result,
5 types::{CollectionStats, CollectionStatus, CollectionTask, MarketDataEvent},
6};
7use async_trait::async_trait;
8use flume::Sender;
9use rusty_common::collections::FxHashMap;
10
11#[async_trait]
13pub trait DataCollector: Send + Sync {
14 async fn start_collection(
16 &self,
17 task: CollectionTask,
18 sender: Sender<MarketDataEvent>,
19 ) -> Result<()>;
20
21 async fn stop_collection(&self, exchange: &str, symbol: &str) -> Result<()>;
23
24 async fn get_status(&self, exchange: &str, symbol: &str) -> Option<CollectionStatus>;
26
27 async fn get_stats(&self) -> FxHashMap<String, CollectionStats>;
29}