pub struct Source<T: Record> { /* private fields */ }Expand description
A streaming data source. Cloneable for multi-producer use.
Implementations§
Source§impl<T: Record> Source<T>
impl<T: Record> Source<T>
Sourcepub fn push(&self, record: T) -> Result<(), StreamingError>
pub fn push(&self, record: T) -> Result<(), StreamingError>
Pushes a record. Non-blocking — returns ChannelFull if the buffer is full.
§Errors
Returns StreamingError::ChannelFull if the buffer is full or the sink was dropped.
Sourcepub fn try_push(&self, record: T) -> Result<(), TryPushError<T>>
pub fn try_push(&self, record: T) -> Result<(), TryPushError<T>>
Pushes a record, returning it on failure.
§Errors
Returns TryPushError containing the record if the channel is full.
Sourcepub fn push_batch(&self, records: &[T]) -> usizewhere
T: Clone,
pub fn push_batch(&self, records: &[T]) -> usizewhere
T: Clone,
Pushes multiple records (cloned). Stops at the first failure.
Sourcepub fn push_batch_drain<I>(&self, records: I) -> usizewhere
I: IntoIterator<Item = T>,
pub fn push_batch_drain<I>(&self, records: I) -> usizewhere
I: IntoIterator<Item = T>,
Pushes records from an iterator, consuming them (zero-clone). Stops at the first failure. Returns the number pushed.
Sourcepub fn push_arrow(&self, batch: RecordBatch) -> Result<(), StreamingError>
pub fn push_arrow(&self, batch: RecordBatch) -> Result<(), StreamingError>
Pushes an Arrow RecordBatch directly.
This is more efficient than pushing individual records when you already have data in Arrow format.
§Errors
Returns StreamingError::SchemaMismatch if the batch schema doesn’t match.
Returns StreamingError::ChannelClosed if the sink has been dropped.
Sourcepub fn watermark(&self, timestamp: i64)
pub fn watermark(&self, timestamp: i64)
Emits a watermark timestamp.
Watermarks signal that no events with timestamps less than or equal to this value will arrive in the future. This enables window triggers and garbage collection.
Watermarks are monotonically increasing - if a lower timestamp is passed, it will be ignored.
Sourcepub fn current_watermark(&self) -> i64
pub fn current_watermark(&self) -> i64
Returns the current watermark value.
Sourcepub fn sequence_counter(&self) -> Arc<AtomicU64>
pub fn sequence_counter(&self) -> Arc<AtomicU64>
Returns the shared sequence counter for checkpoint registration.
Sourcepub fn watermark_atomic(&self) -> Arc<AtomicI64>
pub fn watermark_atomic(&self) -> Arc<AtomicI64>
Returns the shared watermark atomic for checkpoint registration.
Sourcepub fn set_event_time_column(&self, column: &str)
pub fn set_event_time_column(&self, column: &str)
Declare which column in the source data represents event time.
When set, source.watermark() enables late-row filtering
without a SQL WATERMARK FOR clause.
Only the first call takes effect; subsequent calls are silently ignored.
Sourcepub fn event_time_column(&self) -> Option<String>
pub fn event_time_column(&self) -> Option<String>
Returns the configured event-time column, if any.
Sourcepub fn set_max_out_of_orderness(&self, dur: Duration)
pub fn set_max_out_of_orderness(&self, dur: Duration)
Set the max out-of-orderness bound for watermark generation.
Only the first call takes effect; subsequent calls are silently ignored.
Sourcepub fn max_out_of_orderness(&self) -> Option<Duration>
pub fn max_out_of_orderness(&self) -> Option<Duration>
Returns the configured max out-of-orderness, if any.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Source<T>
impl<T> !RefUnwindSafe for Source<T>
impl<T> Send for Source<T>
impl<T> Sync for Source<T>
impl<T> Unpin for Source<T>
impl<T> UnsafeUnpin for Source<T>
impl<T> !UnwindSafe for Source<T>
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more