K
- Type of the keysV
- Type of the valuespublic class SharedBuffer<K extends Serializable,V> extends Object implements Serializable
The idea of the implementation is to have for each key a dedicated SharedBufferPage
. Each
buffer page maintains a collection of the inserted values.
The values are wrapped in a SharedBufferEntry
. The shared buffer entry 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".
Modifier and Type | Class and Description |
---|---|
static class |
SharedBuffer.SharedBufferSerializer<K extends Serializable,V>
A
TypeSerializer for the SharedBuffer . |
static class |
SharedBuffer.SharedBufferSerializerConfigSnapshot<K,V>
The
TypeSerializerConfigSnapshot serializer configuration to be stored with the managed state. |
Constructor and Description |
---|
SharedBuffer(TypeSerializer<V> valueSerializer) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
List<Map<K,List<V>>> |
extractPatterns(K key,
V value,
long timestamp,
int counter,
DeweyNumber version)
Returns all elements from the previous relation starting at the given value with the
given key and timestamp.
|
TypeSerializer<V> |
getValueSerializer() |
int |
hashCode() |
boolean |
isEmpty() |
void |
lock(K key,
V value,
long timestamp,
int counter)
Increases the reference counter for the given value, key, timestamp entry so that it is not
accidentally removed.
|
boolean |
prune(long pruningTimestamp)
Deletes all entries in each page which have expired with respect to given pruning timestamp.
|
int |
put(K key,
V value,
long timestamp,
DeweyNumber version)
Stores given value (value + timestamp) under the given key.
|
int |
put(K key,
V value,
long timestamp,
K previousKey,
V previousValue,
long previousTimestamp,
int previousCounter,
DeweyNumber version)
Stores given value (value + timestamp) under the given key.
|
void |
release(K key,
V value,
long timestamp,
int counter)
Decreases the reference counter for the given value, key, timestamp entry so that it can be
removed once the reference counter reaches 0.
|
String |
toString() |
public SharedBuffer(TypeSerializer<V> valueSerializer)
public TypeSerializer<V> getValueSerializer()
public int put(K key, V value, long timestamp, K previousKey, V previousValue, long previousTimestamp, int previousCounter, DeweyNumber version)
key
- Key of the current valuevalue
- Current valuetimestamp
- Timestamp of the current value (a value requires always a timestamp to make it uniquely referable))previousKey
- Key of the value for the previous relationpreviousValue
- Value for the previous relationpreviousTimestamp
- Timestamp of the value for the previous relationversion
- Version of the previous relationpublic int put(K key, V value, long timestamp, DeweyNumber version)
key
- Key of the current valuevalue
- Current valuetimestamp
- Timestamp of the current value (a value requires always a timestamp to make it uniquely referable))version
- Version of the previous relationpublic boolean isEmpty()
public boolean prune(long pruningTimestamp)
pruningTimestamp
- The time which is used for pruning. All elements whose timestamp is
lower than the pruning timestamp will be removed.true
if pruning happenedpublic List<Map<K,List<V>>> extractPatterns(K key, V value, long timestamp, int counter, DeweyNumber version)
key
- Key of the starting valuevalue
- Value of the starting elementtimestamp
- Timestamp of the starting valueversion
- Version of the previous relation which shall be extractedpublic void lock(K key, V value, long timestamp, int counter)
key
- Key of the value to lockvalue
- Value to locktimestamp
- Timestamp of the value to lockpublic void release(K key, V value, long timestamp, int counter)
key
- Key of the value to releasevalue
- Value to releasetimestamp
- Timestamp of the value to releaseCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.