fluxus_transformers/operator/
mod.rs1use async_trait::async_trait;
2use fluxus_utils::models::{Record, StreamResult};
3
4mod builder;
5mod filter;
6mod map;
7mod window_match;
8mod window_reduce;
9
10pub use builder::OperatorBuilder;
11pub use filter::FilterOperator;
12pub use map::MapOperator;
13pub use window_match::{WindowAllOperator, WindowAnyOperator};
14pub use window_reduce::WindowReduceOperator;
15
16#[async_trait]
18pub trait Operator<In, Out>: Send {
19 async fn init(&mut self) -> StreamResult<()> {
21 Ok(())
22 }
23
24 async fn process(&mut self, record: Record<In>) -> StreamResult<Vec<Record<Out>>>;
26
27 async fn on_window_trigger(&mut self) -> StreamResult<Vec<Record<Out>>> {
29 Ok(Vec::new())
30 }
31
32 async fn close(&mut self) -> StreamResult<()> {
34 Ok(())
35 }
36}