pub struct WriteStream<D: Data> { /* private fields */ }Expand description
A WriteStream allows operators to send data to other operators.
Data is sent via Messages, which are broadcast to operators that are connected to the stream.
Messages are rapidly sent to operators within the same node using zero-copy communication.
Messages sent across nodes are serialized using
abomonation if possible,
before falling back to bincode.
§Example
The following example shows an operator which sends a sequence of numbers on a WriteStream,
and ensures that downstream operators progress by sending a watermark after each number.
struct CounterOperator {}
impl Source<usize> for CounterOperator {
fn run(&mut self, config: &OperatorConfig, write_stream: &mut WriteStream<usize>) {
for t in 0..10 {
let timestamp = Timestamp::Time(vec![t as u64]);
write_stream
.send(Message::new_message(timestamp.clone(), t))
.unwrap();
write_stream
.send(Message::new_watermark(timestamp))
.unwrap();
thread::sleep(Duration::from_millis(100));
}
}
}Implementations§
Source§impl<D: Data> WriteStream<D>
impl<D: Data> WriteStream<D>
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Returns true if a top watermark message was received or the
IngestStream failed to set up.
Sourcepub fn clear_state(&mut self, timestamp: Timestamp)
pub fn clear_state(&mut self, timestamp: Timestamp)
Clears the condition context state.
Trait Implementations§
Source§impl<D: Clone + Data> Clone for WriteStream<D>
impl<D: Clone + Data> Clone for WriteStream<D>
Source§fn clone(&self) -> WriteStream<D>
fn clone(&self) -> WriteStream<D>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<D: Data> Debug for WriteStream<D>
impl<D: Data> Debug for WriteStream<D>
Source§impl<'a, D: Data + Deserialize<'a>> WriteStreamT<D> for WriteStream<D>
impl<'a, D: Data + Deserialize<'a>> WriteStreamT<D> for WriteStream<D>
Auto Trait Implementations§
impl<D> Freeze for WriteStream<D>
impl<D> RefUnwindSafe for WriteStream<D>
impl<D> Send for WriteStream<D>
impl<D> Sync for WriteStream<D>
impl<D> Unpin for WriteStream<D>
impl<D> UnwindSafe for WriteStream<D>
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
Mutably borrows from an owned value. Read more