Skip to main content

PipelineConfig

Struct PipelineConfig 

Source
#[non_exhaustive]
pub struct PipelineConfig { pub pipeline: PipelineSection, pub admin: AdminSection, pub backpressure: BackpressureSection, pub checkpoint: CheckpointSection, pub metrics: MetricsSection, pub source: ComponentConfig, pub deserializer: Option<ComponentConfig>, pub sink: Option<ComponentConfig>, pub sinks: Option<BTreeMap<String, ComponentConfig>>, }
Expand description

Root of a pipeline’s configuration file.

One process runs one pipeline; one file configures one process.

Construct with PipelineConfig::new, or PipelineConfig::new_multi_sink for a sinks: map, and set the optional fields. The struct is #[non_exhaustive] so new sections can be added without breaking callers.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§pipeline: PipelineSection

Identity and thread budget.

§admin: AdminSection

The admin server carrying /metrics, /healthz and /readyz.

§backpressure: BackpressureSection

In-flight budget and pause/resume hysteresis.

§checkpoint: CheckpointSection

Watermark commit policy.

§metrics: MetricsSection

Exporter selection and observability knobs.

§source: ComponentConfig

The source component (opaque body).

§deserializer: Option<ComponentConfig>

Optional deserializer component (opaque body). Sources that emit ready-made records need none.

§sink: Option<ComponentConfig>

Single sink component (opaque body), sugar for the common one-sink case, addressed as "default". Mutually exclusive with sinks. Resolve via sink_config.

§sinks: Option<BTreeMap<String, ComponentConfig>>

Named sinks for a multi-sink split: a name -> component map, each an ordinary single-key component (clickhouse: {...}). Mutually exclusive with sink. Resolve via sink_config.

Implementations§

Source§

impl PipelineConfig

Source

pub fn new( pipeline: PipelineSection, source: ComponentConfig, sink: ComponentConfig, ) -> PipelineConfig

A config for one source and one sink, the sink: form. Every optional section starts at its YAML default, and the sink is addressed as "default" by sink_config.

use spate_core::config::{ComponentConfig, PipelineConfig, PipelineSection, YamlValue};
use std::time::Duration;

let mut pipeline = PipelineSection::new("orders");
pipeline.io_threads = 4;

let mut cfg = PipelineConfig::new(
    pipeline,
    ComponentConfig::new("memory", YamlValue::Mapping(Default::default())),
    ComponentConfig::new("memory", YamlValue::Mapping(Default::default())),
);
cfg.checkpoint.interval = Duration::from_secs(10);
cfg.validate()?;

assert_eq!(cfg.sink_config("default")?.type_tag(), "memory");
Source

pub fn new_multi_sink( pipeline: PipelineSection, source: ComponentConfig, sinks: BTreeMap<String, ComponentConfig>, ) -> PipelineConfig

A config for one source and a map of named sinks, the sinks: form. Every optional section starts at its YAML default, and each name addresses its sink through sink_config.

The map is not checked here. validate rejects an empty map, an empty name, and the reserved name "sink".

use spate_core::config::{ComponentConfig, PipelineConfig, PipelineSection, YamlValue};
use std::collections::BTreeMap;

let body = || YamlValue::Mapping(Default::default());
let sinks = BTreeMap::from([
    ("eu".to_owned(), ComponentConfig::new("memory", body())),
    ("us".to_owned(), ComponentConfig::new("memory", body())),
]);

let cfg = PipelineConfig::new_multi_sink(
    PipelineSection::new("orders"),
    ComponentConfig::new("memory", body()),
    sinks,
);
cfg.validate()?;

assert_eq!(cfg.sink_names(), ["eu", "us"]);
Source

pub fn with_deserializer(self, deserializer: ComponentConfig) -> PipelineConfig

The same config with a deserializer component, tagged with its section the way the constructors tag the source and the sink.

use spate_core::config::{ComponentConfig, PipelineConfig, PipelineSection, YamlValue};

let body = || YamlValue::Mapping(Default::default());
let cfg = PipelineConfig::new(
    PipelineSection::new("orders"),
    ComponentConfig::new("memory", body()),
    ComponentConfig::new("memory", body()),
)
.with_deserializer(ComponentConfig::new("json", body()));

assert_eq!(
    cfg.deserializer.as_ref().map(ComponentConfig::type_tag),
    Some("json")
);
Source

pub fn from_str(text: &str) -> Result<Self, ConfigError>

Load from YAML text: interpolate ${VAR} forms against the process environment, parse, and validate.

Source

pub fn from_path(path: &Path) -> Result<Self, ConfigError>

Load from a YAML file (read, interpolate, parse, validate).

Source

pub fn validate(&self) -> Result<(), ConfigError>

Cross-field validation, run automatically by the loaders. Public so programmatically built configs (tests, spate-test) get the same checks.

Source

pub fn sink_config(&self, name: &str) -> Result<&ComponentConfig, ConfigError>

The component config for the sink named name. The single-sink sink: form is addressed as "default". A connector factory calls this once per sink to build it.

§Errors

ConfigError::Validation if no sink is configured under name.

Source

pub fn sink_names(&self) -> Vec<String>

The configured sink names, sorted. A single-sink config reports ["default"].

Trait Implementations§

Source§

impl Debug for PipelineConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PipelineConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for PipelineConfig

Source§

fn eq(&self, other: &PipelineConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PipelineConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more