Skip to main content

FeedSection

Struct FeedSection 

Source
#[non_exhaustive]
pub struct FeedSection { pub units_held: Option<NonZeroUsize>, pub attempt_cap: Option<NonZeroU32>, pub location: Option<String>, pub settling_window: Option<Duration>, /* private fields */ }
Expand description

The pipeline’s feed: section, handed to the source through Source::configure_feed.

One key names the backend, with the same single-key shape as source:; its body holds the backend’s own keys and is decoded by the backend. units_held applies whatever the backend; attempt_cap applies to the in-process and Kafka feeds, and a backend that cannot honor it refuses it; a source that re-enqueues units caps them at it. location names a job location for a source that reads one, and settling_window is the settling window of a source that ends a job with a location; the in-process feed refuses both.

feed:
  memory: {}
  units_held: 32

Construct one in code with FeedSection::new and set the optional fields. The struct is #[non_exhaustive] so new keys 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.
§units_held: Option<NonZeroUsize>

Units the source holds and reads at once. None leaves the source’s own default.

§attempt_cap: Option<NonZeroU32>

The delivery on which a failed unit moves to its feed’s dead-letter destination, on the in-process and Kafka feeds. The Kafka feed also moves a unit whose recorded deliveries have reached it, without delivering it again. None leaves the backend’s default. A backend that cannot honor the key refuses it. A source that re-enqueues units caps their re-enqueues at it.

§location: Option<String>

A job location, an object-store prefix, for a source that reads one; that source defines what the prefix holds. None when the section names none. The in-process feed refuses one.

§settling_window: Option<Duration>

The settling window of a job with a location, for a source that ends one through an EndCheck: how long the feed must read empty before the job ends. The source’s page says what else it bounds. None leaves DEFAULT_SETTLING_WINDOW. The in-process feed refuses one.

Implementations§

Source§

impl FeedSection

Source

pub fn new(backend: ComponentConfig) -> FeedSection

A section naming backend, with every other key unset. Errors from the backend’s body carry paths such as feed.memory.<key>.

use spate_core::config::{ComponentConfig, FeedSection, YamlValue};
use std::num::NonZeroUsize;

let mut feed = FeedSection::new(ComponentConfig::new(
    "memory",
    YamlValue::Mapping(Default::default()),
));
feed.units_held = NonZeroUsize::new(32);

assert_eq!(feed.backend().type_tag(), "memory");
Source

pub fn backend(&self) -> &ComponentConfig

The backend component (<backend>: { ... }). Its type_tag is the key a feed’s backend must return.

Source

pub fn settling_window_or_default(&self) -> Duration

The section’s settling_window, or DEFAULT_SETTLING_WINDOW when it sets none.

Trait Implementations§

Source§

impl Clone for FeedSection

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FeedSection

Source§

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

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

impl<'de> Deserialize<'de> for FeedSection

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 FeedSection

Source§

fn eq(&self, other: &Self) -> 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 FeedSection

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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