Alexey Velikiy
3 years ago
7 changed files with 99 additions and 31 deletions
@ -0,0 +1,27 @@ |
|||||||
|
use tokio::sync::mpsc; |
||||||
|
|
||||||
|
use crate::services::segments_service::Segment; |
||||||
|
|
||||||
|
use super::types::{AnalyticRequest}; |
||||||
|
|
||||||
|
/// CLient to be used multithreaded
|
||||||
|
///
|
||||||
|
///
|
||||||
|
#[derive(Clone)] |
||||||
|
pub struct AnalyticClient { |
||||||
|
tx: mpsc::Sender<AnalyticRequest>, |
||||||
|
} |
||||||
|
|
||||||
|
impl AnalyticClient { |
||||||
|
pub fn new(tx: mpsc::Sender<AnalyticRequest>) -> AnalyticClient { |
||||||
|
AnalyticClient { tx } |
||||||
|
} |
||||||
|
pub async fn run_learning(&self) -> anyhow::Result<()> { |
||||||
|
self.tx.send(AnalyticRequest::RunLearning).await?; |
||||||
|
Ok(()) |
||||||
|
} |
||||||
|
|
||||||
|
pub async fn get_pattern_detection(&self, from: u64, to: u64) -> anyhow::Result<Vec<Segment>> { |
||||||
|
return Ok(Vec::new()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
mod analytic_service; |
||||||
|
mod pattern_detector; |
||||||
|
mod types; |
||||||
|
|
||||||
|
pub mod analytic_client; |
||||||
|
|
||||||
|
pub use analytic_service::AnalyticService; |
@ -0,0 +1,8 @@ |
|||||||
|
use tokio::sync::oneshot; |
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)] |
||||||
|
pub enum AnalyticRequest { |
||||||
|
// Status,
|
||||||
|
RunLearning, |
||||||
|
// Detect { from: u64, to: u64 },
|
||||||
|
} |
Loading…
Reference in new issue