Class SharedBuffer<V>
- java.lang.Object
-
- org.apache.flink.cep.nfa.sharedbuffer.SharedBuffer<V>
-
- Type Parameters:
V
- Type of the values
public class SharedBuffer<V> extends Object
A shared buffer implementation which stores values under according state. Additionally, the values can be versioned such that it is possible to retrieve their predecessor element in the buffer.The idea of the implementation is to have a buffer for incoming events with unique ids assigned to them. This way we do not need to deserialize events during processing and we store only one copy of the event.
The entries in
SharedBuffer
areSharedBufferNode
. The shared buffer node allows to store relations between different entries. A dewey versioning scheme allows to discriminate between different relations (e.g. preceding element).The implementation is strongly based on the paper "Efficient Pattern Matching over Event Streams".
-
-
Constructor Summary
Constructors Constructor Description SharedBuffer(org.apache.flink.api.common.state.KeyedStateStore stateStore, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
SharedBuffer(org.apache.flink.api.common.state.KeyedStateStore stateStore, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer, SharedBufferCacheConfig cacheConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SharedBufferAccessor<V>
getAccessor()
Construct an accessor to deal with this sharedBuffer.int
getEventsBufferCacheSize()
int
getEventsBufferSize()
int
getSharedBufferNodeCacheSize()
int
getSharedBufferNodeSize()
boolean
isEmpty()
Checks if there is no elements in the buffer.void
releaseCacheStatisticsTimer()
-
-
-
Constructor Detail
-
SharedBuffer
@VisibleForTesting public SharedBuffer(org.apache.flink.api.common.state.KeyedStateStore stateStore, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
-
SharedBuffer
public SharedBuffer(org.apache.flink.api.common.state.KeyedStateStore stateStore, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer, SharedBufferCacheConfig cacheConfig)
-
-
Method Detail
-
getAccessor
public SharedBufferAccessor<V> getAccessor()
Construct an accessor to deal with this sharedBuffer.- Returns:
- an accessor to deal with this sharedBuffer.
-
isEmpty
public boolean isEmpty() throws Exception
Checks if there is no elements in the buffer.- Returns:
- true if there is no elements in the buffer
- Throws:
Exception
- Thrown if the system cannot access the state.
-
releaseCacheStatisticsTimer
public void releaseCacheStatisticsTimer()
-
getEventsBufferCacheSize
@VisibleForTesting public int getEventsBufferCacheSize()
-
getEventsBufferSize
@VisibleForTesting public int getEventsBufferSize() throws Exception
- Throws:
Exception
-
getSharedBufferNodeSize
@VisibleForTesting public int getSharedBufferNodeSize() throws Exception
- Throws:
Exception
-
-