T - The type of elements that can be added to this WindowBuffer.ACC - The type of the accumulator that this WindowBuffer can store.@Internal public class FoldingWindowBuffer<T,ACC> extends Object implements WindowBuffer<T,ACC>
WindowBuffer that stores elements on the Java Heap. This buffer uses a
FoldFunction to incrementally aggregate elements that are added to the buffer.| Modifier and Type | Class and Description |
|---|---|
static class |
FoldingWindowBuffer.Factory<T,ACC> |
| Modifier | Constructor and Description |
|---|---|
protected |
FoldingWindowBuffer(org.apache.flink.api.common.functions.FoldFunction<T,ACC> foldFunction,
ACC initialAccumulator,
org.apache.flink.api.common.typeutils.TypeSerializer<ACC> accSerializer) |
protected |
FoldingWindowBuffer(org.apache.flink.api.common.functions.FoldFunction<T,ACC> foldFunction,
StreamRecord<ACC> initialAccumulator,
org.apache.flink.api.common.typeutils.TypeSerializer<ACC> accSerializer) |
| Modifier and Type | Method and Description |
|---|---|
Iterable<StreamRecord<ACC>> |
getElements()
Returns all elements that are currently in the buffer.
|
Iterable<ACC> |
getUnpackedElements()
Returns all elements that are currently in the buffer.
|
int |
size()
Returns the number of elements that are currently in the buffer.
|
void |
snapshot(org.apache.flink.core.memory.DataOutputView out)
Writes the contents of the window buffer to a
DataOutputView for checkpointing. |
void |
storeElement(StreamRecord<T> element)
Adds the element to the buffer.
|
protected FoldingWindowBuffer(org.apache.flink.api.common.functions.FoldFunction<T,ACC> foldFunction, ACC initialAccumulator, org.apache.flink.api.common.typeutils.TypeSerializer<ACC> accSerializer)
protected FoldingWindowBuffer(org.apache.flink.api.common.functions.FoldFunction<T,ACC> foldFunction, StreamRecord<ACC> initialAccumulator, org.apache.flink.api.common.typeutils.TypeSerializer<ACC> accSerializer)
public void storeElement(StreamRecord<T> element) throws Exception
WindowBufferstoreElement in interface WindowBuffer<T,ACC>element - The element to add.Exceptionpublic Iterable<StreamRecord<ACC>> getElements()
WindowBuffergetElements in interface WindowBuffer<T,ACC>public Iterable<ACC> getUnpackedElements()
WindowBufferStreamRecord.getUnpackedElements in interface WindowBuffer<T,ACC>public int size()
WindowBuffersize in interface WindowBuffer<T,ACC>public void snapshot(org.apache.flink.core.memory.DataOutputView out)
throws IOException
WindowBufferDataOutputView for checkpointing.snapshot in interface WindowBuffer<T,ACC>IOExceptionCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.