fluxus_core/source/mod.rs
1pub mod csv;
2pub mod generator;
3
4use crate::models::{Record, StreamResult};
5pub use csv::CsvSource;
6pub use generator::GeneratorSource;
7
8use async_trait::async_trait;
9
10/// Source trait defines the interface for data sources
11#[async_trait]
12pub trait Source<T> {
13 /// Initialize the source
14 async fn init(&mut self) -> StreamResult<()>;
15
16 /// Read the next record from the source
17 async fn next(&mut self) -> StreamResult<Option<Record<T>>>;
18
19 /// Close the source and release resources
20 async fn close(&mut self) -> StreamResult<()>;
21}