V
- Type of the valuespublic class SharedBuffer<V> extends Object
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
are SharedBufferNode
. 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 and Description |
---|
SharedBuffer(KeyedStateStore stateStore,
TypeSerializer<V> valueSerializer) |
Modifier and Type | Method and Description |
---|---|
SharedBufferAccessor<V> |
getAccessor()
Construct an accessor to deal with this sharedBuffer.
|
int |
getEventsBufferCacheSize() |
int |
getEventsBufferSize() |
int |
getSharedBufferNodeCacheSize() |
int |
getSharedBufferNodeSize() |
void |
init(Map<EventId,Lockable<V>> events,
Map<NodeId,Lockable<SharedBufferNode>> entries)
Deprecated.
Only for state migration!
|
boolean |
isEmpty()
Checks if there is no elements in the buffer.
|
public SharedBuffer(KeyedStateStore stateStore, TypeSerializer<V> valueSerializer)
@Deprecated public void init(Map<EventId,Lockable<V>> events, Map<NodeId,Lockable<SharedBufferNode>> entries) throws Exception
events
- map of events with assigned unique idsentries
- map of SharedBufferNodesException
- Thrown if the system cannot access the state.public SharedBufferAccessor<V> getAccessor()
public boolean isEmpty() throws Exception
Exception
- Thrown if the system cannot access the state.@VisibleForTesting public int getEventsBufferCacheSize()
@VisibleForTesting public int getEventsBufferSize() throws Exception
Exception
@VisibleForTesting public int getSharedBufferNodeSize() throws Exception
Exception
@VisibleForTesting public int getSharedBufferNodeCacheSize() throws Exception
Exception
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.