rusty_bin/monitor/collector/
traits.rs

1//! Traits for the data collection module.
2
3use 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/// Trait for data collection handlers.
12#[async_trait]
13pub trait DataCollector: Send + Sync {
14    /// Start collecting data for the specified task.
15    async fn start_collection(
16        &self,
17        task: CollectionTask,
18        sender: Sender<MarketDataEvent>,
19    ) -> Result<()>;
20
21    /// Stop collecting data for the specified exchange and symbol.
22    async fn stop_collection(&self, exchange: &str, symbol: &str) -> Result<()>;
23
24    /// Get current collection status.
25    async fn get_status(&self, exchange: &str, symbol: &str) -> Option<CollectionStatus>;
26
27    /// Get overall statistics.
28    async fn get_stats(&self) -> FxHashMap<String, CollectionStats>;
29}