Struct erdos::dataflow::WriteStream
source · [−]pub struct WriteStream<D: Data> { /* private fields */ }
Expand description
A WriteStream
allows operators to send data to other operators.
Data
is sent via Message
s, 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
sourceimpl<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
sourceimpl<D: Clone + Data> Clone for WriteStream<D>
impl<D: Clone + Data> Clone for WriteStream<D>
sourcefn clone(&self) -> WriteStream<D>
fn clone(&self) -> WriteStream<D>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<D: Data> Debug for WriteStream<D>
impl<D: Data> Debug for WriteStream<D>
sourceimpl<'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> !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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more