Skip to main content

kinetic_core/
serverless.rs

1//! Traits for Kinetic Serverless components.
2
3use crate::healthcheck::Healthcheck;
4
5/// Trait for Serverless Receiver configurations.
6pub trait ReceiverConfig: Healthcheck + Send + Sync {
7    /// Returns the port to listen on.
8    fn port(&self) -> u16;
9}
10
11/// Trait for Serverless Processor configurations.
12///
13/// Processors transform OTel data into Arrow/Parquet format using fixed
14/// schemas per signal type (logs, metrics, traces).
15pub trait ProcessorConfig: Healthcheck + Send + Sync {
16    /// Returns the Arrow schema to use for this signal type.
17    fn arrow_schema(&self) -> arrow_schema::SchemaRef;
18    /// Returns the compression codec for output (e.g. lz4, snappy, zstd, gzip).
19    fn compression(&self) -> &str;
20}
21
22/// Trait for Serverless Emitter configurations.
23pub trait EmitterConfig: Healthcheck + Send + Sync {
24    /// Returns the batch size (event count).
25    fn batch_size(&self) -> usize;
26    /// Returns the batch timeout in seconds.
27    fn batch_timeout_secs(&self) -> u64;
28}
29
30/// Trait for Batch Writer configurations.
31pub trait BatchWriterConfig: Healthcheck + Send + Sync {
32    /// Returns the maximum events per file.
33    fn max_events_per_file(&self) -> usize;
34    /// Returns the maximum bytes per file.
35    fn max_bytes_per_file(&self) -> usize;
36    /// Returns the maximum age of a batch in seconds.
37    fn max_age_secs(&self) -> u64;
38}