pub struct ProjectionBindingBuilder { /* private fields */ }Expand description
Fluent builder for a ProjectionBinding.
Implementations§
Source§impl ProjectionBindingBuilder
impl ProjectionBindingBuilder
Sourcepub fn source(self, stream: impl Into<String>, topic: impl Into<String>) -> Self
pub fn source(self, stream: impl Into<String>, topic: impl Into<String>) -> Self
Set the binding source. A source is always a (stream, topic) pair,
and a topic only exists within a stream, so both are required.
Sourcepub fn selector(self, source: SourceSelector) -> Self
pub fn selector(self, source: SourceSelector) -> Self
Set the binding source from a pre-built SourceSelector.
Sourcepub fn allow(self, projection: impl Into<ProjectionId>) -> Self
pub fn allow(self, projection: impl Into<ProjectionId>) -> Self
Allow records to route to this projection.
Sourcepub fn default_projection(self, projection: impl Into<ProjectionId>) -> Self
pub fn default_projection(self, projection: impl Into<ProjectionId>) -> Self
Projection used when a record carries no agdx.ref.
Sourcepub fn add_target(self, target: Target) -> Self
pub fn add_target(self, target: Target) -> Self
Add a materialization target. The first read_write target serves
queries. Further targets are write-only mirrors.
Sourcepub fn retention(self, retention: RetentionPolicy) -> Self
pub fn retention(self, retention: RetentionPolicy) -> Self
Set how long the materialized rows live, independent of the source topic’s Iggy retention. Omit to inherit the managed backend’s default.
// Short-lived topic, permanent index:
let binding = ProjectionBinding::builder()
.source("_agdx", "telemetry")
.allow("telemetry.v1")
.target_table("telemetry_rows")
.retention(RetentionPolicy::Keep)
.build();Sourcepub fn target_table(self, table: impl Into<String>) -> Self
pub fn target_table(self, table: impl Into<String>) -> Self
Materialize into a table of this name on the embedded backend: sugar for
a single read_write, effectively_once target. The common case.
Sourcepub fn target_on(
self,
backend: impl Into<String>,
table: impl Into<String>,
) -> Self
pub fn target_on( self, backend: impl Into<String>, table: impl Into<String>, ) -> Self
Materialize into table on a named backend: the read_write,
effectively_once query-serving home. This is how a binding routes one
index to a specific configured backend (e.g. an external warehouse
declared as warehouse) while other bindings stay on embedded, so
different topics materialize to and are served from different stores at
once.
// orders -> external warehouse, events stay on the embedded engine.
let binding = ProjectionBinding::builder()
.source("shop", "orders")
.allow("orders.v1")
.target_on("warehouse", "orders_rows")
.build();Sourcepub fn mirror_to(
self,
backend: impl Into<String>,
table: impl Into<String>,
) -> Self
pub fn mirror_to( self, backend: impl Into<String>, table: impl Into<String>, ) -> Self
Add a write-only mirror of this binding’s rows into table on a named
backend. The mirror does not serve queries (exactly one read_write
target does) and is non-blocking, so one projection can fan the same rows
to several backends at once (e.g. the embedded engine for low-latency
reads plus an external warehouse for analytics).
Sourcepub fn notify(self) -> Self
pub fn notify(self) -> Self
Opt into the change feed: one ChangeRecord per committed projector
batch for this binding, on the changes topic.
Sourcepub fn build(self) -> ProjectionBinding
pub fn build(self) -> ProjectionBinding
Build the binding. Panics if .source(..) / .selector(..) was not set
(programmer error, not user input). Prefer try_build
for code paths that handle config-load failures gracefully.
Sourcepub fn try_build(self) -> Result<ProjectionBinding, InvalidError>
pub fn try_build(self) -> Result<ProjectionBinding, InvalidError>
Build the binding, returning an error if required fields are missing instead of panicking.
Trait Implementations§
Source§impl Default for ProjectionBindingBuilder
impl Default for ProjectionBindingBuilder
Source§fn default() -> ProjectionBindingBuilder
fn default() -> ProjectionBindingBuilder
Auto Trait Implementations§
impl Freeze for ProjectionBindingBuilder
impl RefUnwindSafe for ProjectionBindingBuilder
impl Send for ProjectionBindingBuilder
impl Sync for ProjectionBindingBuilder
impl Unpin for ProjectionBindingBuilder
impl UnsafeUnpin for ProjectionBindingBuilder
impl UnwindSafe for ProjectionBindingBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.