Enum renoir::operator::StreamElement
source · pub enum StreamElement<Out> {
Item(Out),
Timestamped(Out, Timestamp),
Watermark(Timestamp),
FlushBatch,
Terminate,
FlushAndRestart,
}
Expand description
An element of the stream. This is what enters and exits from the operators.
An operator may need to change the content of a StreamElement
(e.g. a Map
may change the
value of the Item
). Usually Watermark
and FlushAndRestart
are simply forwarded to the next
operator in the chain.
In general a stream may be composed of a sequence of this kind:
((Item | Timestamped | Watermark | FlushBatch)* FlushAndRestart)+ Terminate
Variants§
Item(Out)
A normal element containing just the value of the message.
Timestamped(Out, Timestamp)
Like Item
, but it’s attached with a timestamp, it’s used to ensure the ordering of the
messages.
Watermark(Timestamp)
When an operator receives a Watermark
with timestamp t
, the operator will never see any
message with timestamp less or equal to t
.
FlushBatch
Flush the internal batch since there will be too much delay till the next message to come.
Terminate
The stream has ended, and the operators should exit as soon as possible.
No messages should be generated by the operator between a FlushAndRestart
and a
Terminate
.
FlushAndRestart
Mark the end of a stream of data.
Note that this does not mean that the entire stream has ended, for example this is used to mark the end of an iteration. Therefore an operator may be prepared to received new data after this message, but should not retain the internal state.
Implementations§
source§impl<Out> StreamElement<Out>
impl<Out> StreamElement<Out>
sourcepub fn variant(&self) -> StreamElement<()>
pub fn variant(&self) -> StreamElement<()>
Create a new StreamElement
with an Item(())
if self
contains an item, otherwise it
returns the same variant of self
.
sourcepub fn map<NewOut>(self, f: impl FnOnce(Out) -> NewOut) -> StreamElement<NewOut>
pub fn map<NewOut>(self, f: impl FnOnce(Out) -> NewOut) -> StreamElement<NewOut>
Change the type of the element inside the StreamElement
.
sourcepub fn variant_str(&self) -> &'static str
pub fn variant_str(&self) -> &'static str
A string representation of the variant of this StreamElement
.
sourcepub fn timestamp(&self) -> Option<&Timestamp>
pub fn timestamp(&self) -> Option<&Timestamp>
A string representation of the variant of this StreamElement
.
pub fn add_key<Key>(self, k: Key) -> StreamElement<(Key, Out)>
pub fn value(&self) -> Option<&Out>
source§impl<Key, Out> StreamElement<(Key, Out)>
impl<Key, Out> StreamElement<(Key, Out)>
Trait Implementations§
source§impl<Out: Clone> Clone for StreamElement<Out>
impl<Out: Clone> Clone for StreamElement<Out>
source§fn clone(&self) -> StreamElement<Out>
fn clone(&self) -> StreamElement<Out>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Out: Debug> Debug for StreamElement<Out>
impl<Out: Debug> Debug for StreamElement<Out>
source§impl<'de, Out> Deserialize<'de> for StreamElement<Out>where
Out: Deserialize<'de>,
impl<'de, Out> Deserialize<'de> for StreamElement<Out>where
Out: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T> From<WindowResult<T>> for StreamElement<T>
impl<T> From<WindowResult<T>> for StreamElement<T>
source§fn from(value: WindowResult<T>) -> Self
fn from(value: WindowResult<T>) -> Self
source§impl<Out: Ord> Ord for StreamElement<Out>
impl<Out: Ord> Ord for StreamElement<Out>
source§fn cmp(&self, other: &StreamElement<Out>) -> Ordering
fn cmp(&self, other: &StreamElement<Out>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<Out: PartialEq> PartialEq for StreamElement<Out>
impl<Out: PartialEq> PartialEq for StreamElement<Out>
source§fn eq(&self, other: &StreamElement<Out>) -> bool
fn eq(&self, other: &StreamElement<Out>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<Out: PartialOrd> PartialOrd for StreamElement<Out>
impl<Out: PartialOrd> PartialOrd for StreamElement<Out>
source§fn partial_cmp(&self, other: &StreamElement<Out>) -> Option<Ordering>
fn partial_cmp(&self, other: &StreamElement<Out>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Out> Serialize for StreamElement<Out>where
Out: Serialize,
impl<Out> Serialize for StreamElement<Out>where
Out: Serialize,
impl<Out: Eq> Eq for StreamElement<Out>
impl<Out> StructuralPartialEq for StreamElement<Out>
Auto Trait Implementations§
impl<Out> Freeze for StreamElement<Out>where
Out: Freeze,
impl<Out> RefUnwindSafe for StreamElement<Out>where
Out: RefUnwindSafe,
impl<Out> Send for StreamElement<Out>where
Out: Send,
impl<Out> Sync for StreamElement<Out>where
Out: Sync,
impl<Out> Unpin for StreamElement<Out>where
Out: Unpin,
impl<Out> UnwindSafe for StreamElement<Out>where
Out: UnwindSafe,
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<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.