laminar_core/operator/
mod.rs1use std::sync::Arc;
4
5use arrow_array::RecordBatch;
6use smallvec::SmallVec;
7
8pub type TimerKey = SmallVec<[u8; 16]>;
10
11#[derive(Debug, Clone)]
13pub struct Event {
14 pub timestamp: i64,
16 pub data: Arc<RecordBatch>,
18}
19
20impl Event {
21 #[must_use]
23 pub fn new(timestamp: i64, data: RecordBatch) -> Self {
24 Self {
25 timestamp,
26 data: Arc::new(data),
27 }
28 }
29}
30
31#[derive(Debug, thiserror::Error)]
33pub enum OperatorError {
34 #[error("State access failed: {0}")]
36 StateAccessFailed(String),
37
38 #[error("Serialization failed: {0}")]
40 SerializationFailed(String),
41
42 #[error("Processing failed: {0}")]
44 ProcessingFailed(String),
45
46 #[error("Configuration error: {0}")]
48 ConfigError(String),
49}
50
51impl From<arrow_schema::ArrowError> for OperatorError {
52 fn from(e: arrow_schema::ArrowError) -> Self {
53 Self::SerializationFailed(e.to_string())
54 }
55}
56
57pub mod sliding_window;
58pub mod window;
59
60#[cfg(test)]
61mod tests;