@Internal public class CachedBufferStorage extends Object implements BufferStorage
CachedBufferStorage takes the buffers and events from a data stream and adds them to
a memory queue. After a number of elements have been cached, the CachedBufferStorage
can "roll over":
It presents the cached elements as a readable sequence, and creates a new memory queue.
This CachedBufferStorage can be used in credit-based flow control for better barrier
alignment in exactly-once mode.
| Constructor and Description |
|---|
CachedBufferStorage(int pageSize)
Create a new
CachedBufferStorage with unlimited storage. |
CachedBufferStorage(int pageSize,
long maxBufferedBytes,
String taskName)
Creates a new
CachedBufferStorage, caching the buffers or events in memory queue. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent boe)
Adds a buffer or event to the
BufferStorage. |
void |
close()
Cleans up all the resources in the current sequence.
|
long |
getMaxBufferedBytes() |
long |
getPendingBytes() |
long |
getRolledBytes() |
boolean |
isEmpty() |
boolean |
isFull() |
Optional<org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent> |
pollNext() |
void |
rollOver()
Start returning next sequence of stored
BufferOrEvents. |
public CachedBufferStorage(int pageSize)
CachedBufferStorage with unlimited storage.pageSize - The page size used to estimate the cached size.public CachedBufferStorage(int pageSize,
long maxBufferedBytes,
String taskName)
CachedBufferStorage, caching the buffers or events in memory queue.pageSize - The page size used to estimate the cached size.public void add(org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent boe)
BufferStorageBufferStorage.add in interface BufferStorageboe - The buffer or event to be added into the blocker.public void close()
BufferStorageclose in interface AutoCloseableclose in interface BufferStoragepublic long getPendingBytes()
getPendingBytes in interface BufferStoragepublic boolean isFull()
isFull in interface BufferStoragepublic void rollOver()
BufferStorageBufferOrEvents.rollOver in interface BufferStoragepublic long getRolledBytes()
getRolledBytes in interface BufferStoragepublic boolean isEmpty()
isEmpty in interface BufferStorageBufferStorage doesn't store and data.public Optional<org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent> pollNext()
pollNext in interface BufferStoragepublic long getMaxBufferedBytes()
getMaxBufferedBytes in interface BufferStorageCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.