Package org.voltdb.stream.sink
Class IterableSink<T>
java.lang.Object
org.voltdb.stream.sink.IterableSink<T>
- Type Parameters:
T
- the type of elements consumed by this sink
- All Implemented Interfaces:
Consumer<T>
,VoltLifecycle
,VoltStreamSink<T>
Captures all stream items into a list.
This sink is primarily used for testing or scenarios where in-memory storage of streamed data is sufficient. Use only on bounded streams otherwise out of memory error will occur.
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.voltdb.stream.api.pipeline.VoltLifecycle
configure, destroy
Methods inherited from interface org.voltdb.stream.api.pipeline.VoltStreamSink
batchProcessed, commit, nextBatchStarts
-
Constructor Details
-
IterableSink
public IterableSink()
-
-
Method Details
-
consume
Description copied from interface:Consumer
This method is invoked by any upstream caller, the caller can emmit any number of events to a consumer. -
copy
Creates and returns a copy of the current contents of the sink.This method provides a snapshot of all data items that have been consumed up to the point of invocation. Modifications to the returned list do not affect the internal
sink
.- Returns:
- a new
List
containing all elements consumed by this sink
-
clear
public void clear()Clears all data items from the internal sink.After calling this method, the sink will be empty, and subsequent calls to
copy()
will return an empty list until new items are consumed.
-