feldera_types/config.rs
1//! Controller configuration.
2//!
3//! This module defines the controller configuration structure. The leaves of
4//! this structure are individual transport-specific and data-format-specific
5//! endpoint configs. We represent these configs as opaque JSON values, so
6//! that the entire configuration tree can be deserialized from a JSON file.
7
8use crate::transport::adhoc::AdHocInputConfig;
9use crate::transport::datagen::DatagenInputConfig;
10use crate::transport::delta_table::{DeltaTableReaderConfig, DeltaTableWriterConfig};
11use crate::transport::file::{FileInputConfig, FileOutputConfig};
12use crate::transport::http::HttpInputConfig;
13use crate::transport::iceberg::IcebergReaderConfig;
14use crate::transport::kafka::{KafkaInputConfig, KafkaOutputConfig};
15use crate::transport::nexmark::NexmarkInputConfig;
16use crate::transport::postgres::PostgresReaderConfig;
17use crate::transport::pubsub::PubSubInputConfig;
18use crate::transport::redis::RedisOutputConfig;
19use crate::transport::s3::S3InputConfig;
20use crate::transport::url::UrlInputConfig;
21use core::fmt;
22use serde::de::{self, MapAccess, Visitor};
23use serde::{Deserialize, Deserializer, Serialize};
24use serde_json::Value as JsonValue;
25use serde_yaml::Value as YamlValue;
26use std::path::Path;
27use std::{borrow::Cow, collections::BTreeMap};
28use utoipa::ToSchema;
29
30/// Default value of `ConnectorConfig::max_queued_records`.
31pub const fn default_max_queued_records() -> u64 {
32 1_000_000
33}
34
35/// Default maximum batch size for connectors, in records.
36///
37/// If you change this then update the comment on
38/// [ConnectorConfig::max_batch_size].
39pub const fn default_max_batch_size() -> u64 {
40 10_000
41}
42
43/// Pipeline deployment configuration.
44/// It represents configuration entries directly provided by the user
45/// (e.g., runtime configuration) and entries derived from the schema
46/// of the compiled program (e.g., connectors). Storage configuration,
47/// if applicable, is set by the runner.
48#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
49pub struct PipelineConfig {
50 /// Global controller configuration.
51 #[serde(flatten)]
52 #[schema(inline)]
53 pub global: RuntimeConfig,
54
55 /// Pipeline name.
56 pub name: Option<String>,
57
58 /// Configuration for persistent storage
59 ///
60 /// If `global.storage` is `true`, this field must be set to some
61 /// [`StorageConfig`]. If `global.storage` is `false`, the pipeline ignores
62 /// this field.
63 #[serde(default)]
64 pub storage_config: Option<StorageConfig>,
65
66 /// Input endpoint configuration.
67 pub inputs: BTreeMap<Cow<'static, str>, InputEndpointConfig>,
68
69 /// Output endpoint configuration.
70 #[serde(default)]
71 pub outputs: BTreeMap<Cow<'static, str>, OutputEndpointConfig>,
72}
73
74/// Configuration for persistent storage in a [`PipelineConfig`].
75#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
76pub struct StorageConfig {
77 /// A directory to keep pipeline state, as a path on the filesystem of the
78 /// machine or container where the pipeline will run.
79 ///
80 /// When storage is enabled, this directory stores the data for
81 /// [StorageBackendConfig::Default].
82 ///
83 /// When fault tolerance is enabled, this directory stores checkpoints and
84 /// the log.
85 pub path: String,
86
87 /// How to cache access to storage in this pipeline.
88 #[serde(default)]
89 pub cache: StorageCacheConfig,
90}
91
92impl StorageConfig {
93 pub fn path(&self) -> &Path {
94 Path::new(&self.path)
95 }
96}
97
98/// How to cache access to storage within a Feldera pipeline.
99#[derive(Copy, Clone, Default, Deserialize, Serialize, Debug, PartialEq, Eq, ToSchema)]
100#[serde(rename_all = "snake_case")]
101pub enum StorageCacheConfig {
102 /// Use the operating system's page cache as the primary storage cache.
103 ///
104 /// This is the default because it currently performs better than
105 /// `FelderaCache`.
106 #[default]
107 PageCache,
108
109 /// Use Feldera's internal cache implementation.
110 ///
111 /// This is under development. It will become the default when its
112 /// performance exceeds that of `PageCache`.
113 FelderaCache,
114}
115
116impl StorageCacheConfig {
117 #[cfg(unix)]
118 pub fn to_custom_open_flags(&self) -> i32 {
119 match self {
120 StorageCacheConfig::PageCache => (),
121 StorageCacheConfig::FelderaCache => {
122 #[cfg(target_os = "linux")]
123 return libc::O_DIRECT;
124 }
125 }
126 0
127 }
128}
129
130/// Storage configuration for a pipeline.
131#[derive(Debug, Clone, Default, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
132#[serde(default)]
133pub struct StorageOptions {
134 /// How to connect to the underlying storage.
135 pub backend: StorageBackendConfig,
136
137 /// The minimum estimated number of bytes in a batch of data to write it to
138 /// storage. This is provided for debugging and fine-tuning and should
139 /// ordinarily be left unset.
140 ///
141 /// A value of 0 will write even empty batches to storage, and nonzero
142 /// values provide a threshold. `usize::MAX` would effectively disable
143 /// storage.
144 ///
145 /// The default is 1,048,576 (1 MiB).
146 pub min_storage_bytes: Option<usize>,
147
148 /// The form of compression to use in data batches.
149 ///
150 /// Compression has a CPU cost but it can take better advantage of limited
151 /// NVMe and network bandwidth, which means that it can increase overall
152 /// performance.
153 pub compression: StorageCompression,
154
155 /// The maximum size of the in-memory storage cache, in mebibytes.
156 ///
157 /// The default is 256 MiB, times the number of workers.
158 pub cache_mib: Option<usize>,
159}
160
161/// Backend storage configuration.
162#[derive(Debug, Clone, Default, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
163#[serde(tag = "name", content = "config", rename_all = "snake_case")]
164pub enum StorageBackendConfig {
165 /// Use the default storage configuration.
166 ///
167 /// This currently uses the local file system.
168 #[default]
169 Default,
170
171 /// Use `io_uring` to access the local file system.
172 ///
173 /// This falls back to ordinary access to the local file system if
174 /// `io_uring` is unavailable, as is often the case with cloud container
175 /// systems.
176 IoUring,
177}
178
179/// Storage compression algorithm.
180#[derive(Debug, Copy, Clone, Default, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
181#[serde(rename_all = "snake_case")]
182pub enum StorageCompression {
183 /// Use Feldera's default compression algorithm.
184 ///
185 /// The default may change as Feldera's performance is tuned and new
186 /// algorithms are introduced.
187 #[default]
188 Default,
189
190 /// Do not compress.
191 None,
192
193 /// Use [Snappy](https://en.wikipedia.org/wiki/Snappy_(compression)) compression.
194 Snappy,
195}
196
197/// Global pipeline configuration settings. This is the publicly
198/// exposed type for users to configure pipelines.
199#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
200#[serde(default)]
201pub struct RuntimeConfig {
202 /// Number of DBSP worker threads.
203 pub workers: u16,
204
205 /// Storage configuration.
206 ///
207 /// - If this is `None`, the default, the pipeline's state is kept in
208 /// in-memory data-structures. This is useful if the pipeline's state
209 /// will fit in memory and if the pipeline is ephemeral and does not need
210 /// to be recovered after a restart. The pipeline will most likely run
211 /// faster since it does not need to access storage.
212 ///
213 /// - If set, the pipeline's state is kept on storage. This allows the
214 /// pipeline to work with state that will not fit into memory. It also
215 /// allows the state to be checkpointed and recovered across restarts.
216 #[serde(deserialize_with = "deserialize_storage_options")]
217 pub storage: Option<StorageOptions>,
218
219 /// Configures fault tolerance with the specified start up behavior. Fault
220 /// tolerance is disabled if this or `storage` is `None`.
221 #[serde(deserialize_with = "deserialize_fault_tolerance")]
222 pub fault_tolerance: Option<FtConfig>,
223
224 /// Enable CPU profiler.
225 ///
226 /// The default value is `true`.
227 pub cpu_profiler: bool,
228
229 /// Enable pipeline tracing.
230 pub tracing: bool,
231
232 /// Jaeger tracing endpoint to send tracing information to.
233 pub tracing_endpoint_jaeger: String,
234
235 /// Minimal input batch size.
236 ///
237 /// The controller delays pushing input records to the circuit until at
238 /// least `min_batch_size_records` records have been received (total
239 /// across all endpoints) or `max_buffering_delay_usecs` microseconds
240 /// have passed since at least one input records has been buffered.
241 /// Defaults to 0.
242 pub min_batch_size_records: u64,
243
244 /// Maximal delay in microseconds to wait for `min_batch_size_records` to
245 /// get buffered by the controller, defaults to 0.
246 pub max_buffering_delay_usecs: u64,
247
248 /// Resource reservations and limits. This is enforced
249 /// only in Feldera Cloud.
250 pub resources: ResourceConfig,
251
252 /// Real-time clock resolution in microseconds.
253 ///
254 /// This parameter controls the execution of queries that use the `NOW()` function. The output of such
255 /// queries depends on the real-time clock and can change over time without any external
256 /// inputs. The pipeline will update the clock value and trigger incremental recomputation
257 /// at most each `clock_resolution_usecs` microseconds.
258 ///
259 /// It is set to 100 milliseconds (100,000 microseconds) by default.
260 ///
261 /// Set to `null` to disable periodic clock updates.
262 pub clock_resolution_usecs: Option<u64>,
263
264 /// Optionally, a list of CPU numbers for CPUs to which the pipeline may pin
265 /// its worker threads. Specify at least twice as many CPU numbers as
266 /// workers. CPUs are generally numbered starting from 0. The pipeline
267 /// might not be able to honor CPU pinning requests.
268 ///
269 /// CPU pinning can make pipelines run faster and perform more consistently,
270 /// as long as different pipelines running on the same machine are pinned to
271 /// different CPUs.
272 pub pin_cpus: Vec<usize>,
273}
274
275/// Accepts "true" and "false" and converts them to the new format.
276fn deserialize_storage_options<'de, D>(deserializer: D) -> Result<Option<StorageOptions>, D::Error>
277where
278 D: Deserializer<'de>,
279{
280 struct BoolOrStruct;
281
282 impl<'de> Visitor<'de> for BoolOrStruct {
283 type Value = Option<StorageOptions>;
284
285 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
286 formatter.write_str("boolean or StorageOptions")
287 }
288
289 fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
290 where
291 E: de::Error,
292 {
293 match v {
294 false => Ok(None),
295 true => Ok(Some(StorageOptions::default())),
296 }
297 }
298
299 fn visit_unit<E>(self) -> Result<Self::Value, E>
300 where
301 E: de::Error,
302 {
303 Ok(None)
304 }
305
306 fn visit_none<E>(self) -> Result<Self::Value, E>
307 where
308 E: de::Error,
309 {
310 Ok(None)
311 }
312
313 fn visit_map<M>(self, map: M) -> Result<Option<StorageOptions>, M::Error>
314 where
315 M: MapAccess<'de>,
316 {
317 Deserialize::deserialize(de::value::MapAccessDeserializer::new(map)).map(Some)
318 }
319 }
320
321 deserializer.deserialize_any(BoolOrStruct)
322}
323
324/// Accepts old 'initial_state' and 'latest_checkpoint' and converts them to the
325/// new format.
326fn deserialize_fault_tolerance<'de, D>(deserializer: D) -> Result<Option<FtConfig>, D::Error>
327where
328 D: Deserializer<'de>,
329{
330 struct StringOrStruct;
331
332 impl<'de> Visitor<'de> for StringOrStruct {
333 type Value = Option<FtConfig>;
334
335 fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
336 formatter.write_str("none or FtConfig or 'initial_state' or 'latest_checkpoint'")
337 }
338
339 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
340 where
341 E: de::Error,
342 {
343 match v {
344 "initial_state" | "latest_checkpoint" => Ok(Some(FtConfig::default())),
345 _ => Err(de::Error::invalid_value(de::Unexpected::Str(v), &self)),
346 }
347 }
348
349 fn visit_unit<E>(self) -> Result<Self::Value, E>
350 where
351 E: de::Error,
352 {
353 Ok(None)
354 }
355
356 fn visit_none<E>(self) -> Result<Self::Value, E>
357 where
358 E: de::Error,
359 {
360 Ok(None)
361 }
362
363 fn visit_map<M>(self, map: M) -> Result<Option<FtConfig>, M::Error>
364 where
365 M: MapAccess<'de>,
366 {
367 Deserialize::deserialize(de::value::MapAccessDeserializer::new(map)).map(Some)
368 }
369 }
370
371 deserializer.deserialize_any(StringOrStruct)
372}
373
374impl Default for RuntimeConfig {
375 fn default() -> Self {
376 Self {
377 workers: 8,
378 storage: None,
379 fault_tolerance: None,
380 cpu_profiler: true,
381 tracing: {
382 // We discovered that the jaeger crate can use up gigabytes of RAM, so it's not harmless
383 // to keep it on by default.
384 false
385 },
386 tracing_endpoint_jaeger: "127.0.0.1:6831".to_string(),
387 min_batch_size_records: 0,
388 max_buffering_delay_usecs: 0,
389 resources: ResourceConfig::default(),
390 clock_resolution_usecs: {
391 // Every 100 ms.
392 Some(100_000)
393 },
394 pin_cpus: Vec::new(),
395 }
396 }
397}
398
399/// Fault-tolerance configuration for runtime startup.
400#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
401#[serde(default)]
402#[serde(rename_all = "snake_case")]
403pub struct FtConfig {
404 /// Interval between automatic checkpoints, in seconds.
405 ///
406 /// The default is 60 seconds. A value of 0 disables automatic
407 /// checkpointing.
408 pub checkpoint_interval_secs: u64,
409}
410
411impl Default for FtConfig {
412 fn default() -> Self {
413 Self {
414 checkpoint_interval_secs: 60,
415 }
416 }
417}
418
419/// Describes an input connector configuration
420#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
421pub struct InputEndpointConfig {
422 /// The name of the input stream of the circuit that this endpoint is
423 /// connected to.
424 pub stream: Cow<'static, str>,
425
426 /// Connector configuration.
427 #[serde(flatten)]
428 pub connector_config: ConnectorConfig,
429}
430
431/// Deserialize the `start_after` property of a connector configuration.
432/// It requires a non-standard deserialization because we want to accept
433/// either a string or an array of strings.
434fn deserialize_start_after<'de, D>(deserializer: D) -> Result<Option<Vec<String>>, D::Error>
435where
436 D: Deserializer<'de>,
437{
438 let value = Option::<JsonValue>::deserialize(deserializer)?;
439 match value {
440 Some(JsonValue::String(s)) => Ok(Some(vec![s])),
441 Some(JsonValue::Array(arr)) => {
442 let vec = arr
443 .into_iter()
444 .map(|item| {
445 item.as_str()
446 .map(|s| s.to_string())
447 .ok_or_else(|| serde::de::Error::custom("invalid 'start_after' property: expected a string, an array of strings, or null"))
448 })
449 .collect::<Result<Vec<String>, _>>()?;
450 Ok(Some(vec))
451 }
452 Some(JsonValue::Null) | None => Ok(None),
453 _ => Err(serde::de::Error::custom(
454 "invalid 'start_after' property: expected a string, an array of strings, or null",
455 )),
456 }
457}
458
459/// A data connector's configuration
460#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
461pub struct ConnectorConfig {
462 /// Transport endpoint configuration.
463 pub transport: TransportConfig,
464
465 /// Parser configuration.
466 pub format: Option<FormatConfig>,
467
468 /// Name of the index that the connector is attached to.
469 ///
470 /// This property is valid for output connectors only. It is used with data
471 /// transports and formats that expect output updates in the form of key/value
472 /// pairs, where the key typically represents a unique id associated with the
473 /// table or view.
474 ///
475 /// To support such output formats, an output connector can be attached to an
476 /// index created using the SQL CREATE INDEX statement. An index of a table
477 /// or view contains the same updates as the table or view itself, indexed by
478 /// one or more key columns.
479 ///
480 /// See individual connector documentation for details on how they work
481 /// with indexes.
482 pub index: Option<String>,
483
484 /// Output buffer configuration.
485 #[serde(flatten)]
486 pub output_buffer_config: OutputBufferConfig,
487
488 /// Maximum batch size, in records.
489 ///
490 /// This is the maximum number of records to process in one batch through
491 /// the circuit. The time and space cost of processing a batch is
492 /// asymptotically superlinear in the size of the batch, but very small
493 /// batches are less efficient due to constant factors.
494 ///
495 /// This should usually be less than `max_queued_records`, to give the
496 /// connector a round-trip time to restart and refill the buffer while
497 /// batches are being processed.
498 ///
499 /// Some input adapters might not honor this setting.
500 ///
501 /// The default is 10,000.
502 #[serde(default = "default_max_batch_size")]
503 pub max_batch_size: u64,
504
505 /// Backpressure threshold.
506 ///
507 /// Maximal number of records queued by the endpoint before the endpoint
508 /// is paused by the backpressure mechanism.
509 ///
510 /// For input endpoints, this setting bounds the number of records that have
511 /// been received from the input transport but haven't yet been consumed by
512 /// the circuit since the circuit, since the circuit is still busy processing
513 /// previous inputs.
514 ///
515 /// For output endpoints, this setting bounds the number of records that have
516 /// been produced by the circuit but not yet sent via the output transport endpoint
517 /// nor stored in the output buffer (see `enable_output_buffer`).
518 ///
519 /// Note that this is not a hard bound: there can be a small delay between
520 /// the backpressure mechanism is triggered and the endpoint is paused, during
521 /// which more data may be queued.
522 ///
523 /// The default is 1 million.
524 #[serde(default = "default_max_queued_records")]
525 pub max_queued_records: u64,
526
527 /// Create connector in paused state.
528 ///
529 /// The default is `false`.
530 #[serde(default)]
531 pub paused: bool,
532
533 /// Arbitrary user-defined text labels associated with the connector.
534 ///
535 /// These labels can be used in conjunction with the `start_after` property
536 /// to control the start order of connectors.
537 #[serde(default)]
538 pub labels: Vec<String>,
539
540 /// Start the connector after all connectors with specified labels.
541 ///
542 /// This property is used to control the start order of connectors.
543 /// The connector will not start until all connectors with the specified
544 /// labels have finished processing all inputs.
545 #[serde(deserialize_with = "deserialize_start_after")]
546 #[serde(default)]
547 pub start_after: Option<Vec<String>>,
548}
549
550#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
551#[serde(default)]
552pub struct OutputBufferConfig {
553 /// Enable output buffering.
554 ///
555 /// The output buffering mechanism allows decoupling the rate at which the pipeline
556 /// pushes changes to the output transport from the rate of input changes.
557 ///
558 /// By default, output updates produced by the pipeline are pushed directly to
559 /// the output transport. Some destinations may prefer to receive updates in fewer
560 /// bigger batches. For instance, when writing Parquet files, producing
561 /// one bigger file every few minutes is usually better than creating
562 /// small files every few milliseconds.
563 ///
564 /// To achieve such input/output decoupling, users can enable output buffering by
565 /// setting the `enable_output_buffer` flag to `true`. When buffering is enabled, output
566 /// updates produced by the pipeline are consolidated in an internal buffer and are
567 /// pushed to the output transport when one of several conditions is satisfied:
568 ///
569 /// * data has been accumulated in the buffer for more than `max_output_buffer_time_millis`
570 /// milliseconds.
571 /// * buffer size exceeds `max_output_buffer_size_records` records.
572 ///
573 /// This flag is `false` by default.
574 // TODO: on-demand output triggered via the API.
575 pub enable_output_buffer: bool,
576
577 /// Maximum time in milliseconds data is kept in the output buffer.
578 ///
579 /// By default, data is kept in the buffer indefinitely until one of
580 /// the other output conditions is satisfied. When this option is
581 /// set the buffer will be flushed at most every
582 /// `max_output_buffer_time_millis` milliseconds.
583 ///
584 /// NOTE: this configuration option requires the `enable_output_buffer` flag
585 /// to be set.
586 pub max_output_buffer_time_millis: usize,
587
588 /// Maximum number of updates to be kept in the output buffer.
589 ///
590 /// This parameter bounds the maximal size of the buffer.
591 /// Note that the size of the buffer is not always equal to the
592 /// total number of updates output by the pipeline. Updates to the
593 /// same record can overwrite or cancel previous updates.
594 ///
595 /// By default, the buffer can grow indefinitely until one of
596 /// the other output conditions is satisfied.
597 ///
598 /// NOTE: this configuration option requires the `enable_output_buffer` flag
599 /// to be set.
600 pub max_output_buffer_size_records: usize,
601}
602
603impl Default for OutputBufferConfig {
604 fn default() -> Self {
605 Self {
606 enable_output_buffer: false,
607 max_output_buffer_size_records: usize::MAX,
608 max_output_buffer_time_millis: usize::MAX,
609 }
610 }
611}
612
613impl OutputBufferConfig {
614 pub fn validate(&self) -> Result<(), String> {
615 if self.enable_output_buffer
616 && self.max_output_buffer_size_records == Self::default().max_output_buffer_size_records
617 && self.max_output_buffer_time_millis == Self::default().max_output_buffer_time_millis
618 {
619 return Err(
620 "when the 'enable_output_buffer' flag is set, one of 'max_output_buffer_size_records' and 'max_output_buffer_time_millis' settings must be specified"
621 .to_string(),
622 );
623 }
624
625 Ok(())
626 }
627}
628
629/// Describes an output connector configuration
630#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
631pub struct OutputEndpointConfig {
632 /// The name of the output stream of the circuit that this endpoint is
633 /// connected to.
634 pub stream: Cow<'static, str>,
635
636 /// Connector configuration.
637 #[serde(flatten)]
638 pub connector_config: ConnectorConfig,
639}
640
641/// Transport-specific endpoint configuration passed to
642/// `crate::OutputTransport::new_endpoint`
643/// and `crate::InputTransport::new_endpoint`.
644#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
645#[serde(tag = "name", content = "config", rename_all = "snake_case")]
646pub enum TransportConfig {
647 FileInput(FileInputConfig),
648 FileOutput(FileOutputConfig),
649 KafkaInput(KafkaInputConfig),
650 KafkaOutput(KafkaOutputConfig),
651 PubSubInput(PubSubInputConfig),
652 UrlInput(UrlInputConfig),
653 S3Input(S3InputConfig),
654 DeltaTableInput(DeltaTableReaderConfig),
655 DeltaTableOutput(DeltaTableWriterConfig),
656 RedisOutput(RedisOutputConfig),
657 // Prevent rust from complaining about large size difference between enum variants.
658 IcebergInput(Box<IcebergReaderConfig>),
659 PostgresInput(PostgresReaderConfig),
660 Datagen(DatagenInputConfig),
661 Nexmark(NexmarkInputConfig),
662 /// Direct HTTP input: cannot be instantiated through API
663 HttpInput(HttpInputConfig),
664 /// Direct HTTP output: cannot be instantiated through API
665 HttpOutput,
666 /// Ad hoc input: cannot be instantiated through API
667 AdHocInput(AdHocInputConfig),
668}
669
670impl TransportConfig {
671 pub fn name(&self) -> String {
672 match self {
673 TransportConfig::FileInput(_) => "file_input".to_string(),
674 TransportConfig::FileOutput(_) => "file_output".to_string(),
675 TransportConfig::KafkaInput(_) => "kafka_input".to_string(),
676 TransportConfig::KafkaOutput(_) => "kafka_output".to_string(),
677 TransportConfig::PubSubInput(_) => "pub_sub_input".to_string(),
678 TransportConfig::UrlInput(_) => "url_input".to_string(),
679 TransportConfig::S3Input(_) => "s3_input".to_string(),
680 TransportConfig::DeltaTableInput(_) => "delta_table_input".to_string(),
681 TransportConfig::DeltaTableOutput(_) => "delta_table_output".to_string(),
682 TransportConfig::IcebergInput(_) => "iceberg_input".to_string(),
683 TransportConfig::PostgresInput(_) => "postgres_input".to_string(),
684 TransportConfig::Datagen(_) => "datagen".to_string(),
685 TransportConfig::Nexmark(_) => "nexmark".to_string(),
686 TransportConfig::HttpInput(_) => "http_input".to_string(),
687 TransportConfig::HttpOutput => "http_output".to_string(),
688 TransportConfig::AdHocInput(_) => "adhoc_input".to_string(),
689 TransportConfig::RedisOutput(_) => "redis_output".to_string(),
690 }
691 }
692}
693
694/// Data format specification used to parse raw data received from the
695/// endpoint or to encode data sent to the endpoint.
696#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize, ToSchema)]
697pub struct FormatConfig {
698 /// Format name, e.g., "csv", "json", "bincode", etc.
699 pub name: Cow<'static, str>,
700
701 /// Format-specific parser or encoder configuration.
702 #[serde(default)]
703 #[schema(value_type = Object)]
704 pub config: YamlValue,
705}
706
707#[derive(Debug, Clone, Eq, PartialEq, Default, Serialize, Deserialize, ToSchema)]
708#[serde(default)]
709pub struct ResourceConfig {
710 /// The minimum number of CPU cores to reserve
711 /// for an instance of this pipeline
712 pub cpu_cores_min: Option<u64>,
713
714 /// The maximum number of CPU cores to reserve
715 /// for an instance of this pipeline
716 pub cpu_cores_max: Option<u64>,
717
718 /// The minimum memory in Megabytes to reserve
719 /// for an instance of this pipeline
720 pub memory_mb_min: Option<u64>,
721
722 /// The maximum memory in Megabytes to reserve
723 /// for an instance of this pipeline
724 pub memory_mb_max: Option<u64>,
725
726 /// The total storage in Megabytes to reserve
727 /// for an instance of this pipeline
728 pub storage_mb_max: Option<u64>,
729
730 /// Storage class to use for an instance of this pipeline.
731 /// The class determines storage performance such as IOPS and throughput.
732 pub storage_class: Option<String>,
733}