Interface Sink
Accepts output tuples from a pipeline step, possibly for saving results, but also potentially for processing them before having them emerge somewhere else in the pipeline.
Some of this interface is coded for potential asynchronous I/O, but for now we're not respecting it (for the most
part) and neither are we using it. But the idea is that in the future that instead of blocking, a Sink can refuse
to accept more Tuples if some underlying buffer is full.
Note that a Sink doesn't extend AutoCloseable - finish has different semantics to close - finish means we've
stopped writing to it, but it doesn't (necessarily) mean we're ready to do away with the sunk results. So for now
at least they are separate.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanPass a tuple to the sink to consume.default booleanIf this sink is a bounded sink, then this method should return a best guess at whether accept will return true.voidfinish()Tells the sink that there are no more tuples left to accept.default booleanIf true, this sink will never return false fromaccept(Tuple)
-
Field Details
-
DEVNULL
A sink that throws tuples away
-
-
Method Details
-
accept
Pass a tuple to the sink to consume.
- Returns:
- false if the sink is full and can not accept the tuple (right now)
-
finish
void finish()Tells the sink that there are no more tuples left to accept.
-
isUnbounded
default boolean isUnbounded()If true, this sink will never return false from
accept(Tuple) -
canAccept
default boolean canAccept()If this sink is a bounded sink, then this method should return a best guess at whether accept will return true. Calling code should be prepared for
canAcceptto return true but then the call toacceptwill return false.
-