1use kinetic_buffers::{BufferReceiver, BufferSender};
4use kinetic_core::{ComponentId, ShutdownSignal};
5use serde::{Deserialize, Serialize};
6use std::collections::HashMap;
7use tokio::task::JoinHandle;
8
9use std::path::PathBuf;
10
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
13pub struct AcknowledgementsConfig {
14 pub enabled: bool,
16}
17
18pub struct SourceContext {
20 pub id: ComponentId,
21 pub pipeline_id: String,
22 pub out: BufferSender,
23 pub error_out: BufferSender,
24 pub shutdown: ShutdownSignal,
25 pub acknowledgements: AcknowledgementsConfig,
26 pub data_dir: Option<PathBuf>,
27}
28
29pub trait SourceConfig: Send + Sync {
31 fn build(&self, cx: SourceContext) -> anyhow::Result<JoinHandle<()>>;
32}
33
34pub struct TransformContext {
36 pub id: ComponentId,
37 pub pipeline_id: String,
38 pub in_rx: BufferReceiver,
39 pub outs: HashMap<String, BufferSender>,
40 pub shutdown: ShutdownSignal,
41 pub data_dir: Option<PathBuf>,
42}
43
44pub trait TransformConfig: Send + Sync {
46 fn build(&self, cx: TransformContext) -> anyhow::Result<JoinHandle<()>>;
47}
48
49pub struct SinkContext {
51 pub id: ComponentId,
52 pub in_rx: BufferReceiver,
53 pub shutdown: ShutdownSignal,
54 pub acknowledgements: AcknowledgementsConfig,
55 pub data_dir: Option<PathBuf>,
56}
57
58pub trait SinkConfig: Send + Sync {
60 fn build(&self, cx: SinkContext) -> anyhow::Result<JoinHandle<()>>;
61}