public abstract class BaseStateIterator<K,V,KENCODED,VENCODED> extends Object implements Iterator<Map.Entry<K,V>>
Base implementation of iterator over KeyValueState
. Encoded/Decoded types of key and value are all generic.
Constructor and Description |
---|
BaseStateIterator(Iterator<Map.Entry<KENCODED,VENCODED>> pendingPrepareIterator,
Iterator<Map.Entry<KENCODED,VENCODED>> pendingCommitIterator,
Set<KENCODED> initialProvidedKeys)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract K |
decodeKey(KENCODED key)
Decode key to convert encoded type of key to state key type.
|
protected abstract V |
decodeValue(VENCODED value)
Decode value to convert encoded type of value to state value type.
|
boolean |
hasNext() |
protected abstract boolean |
isEndOfDataFromStorage()
Check whether end of data is reached from storage state KVs.
|
protected abstract boolean |
isTombstoneValue(VENCODED value)
Check whether the value is tombstone (deletion mark) value.
|
protected abstract Iterator<Map.Entry<KENCODED,VENCODED>> |
loadChunkFromStateStorage()
Load some part of state KVs from storage and returns iterator of cached data from storage.
|
Map.Entry<K,V> |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public BaseStateIterator(Iterator<Map.Entry<KENCODED,VENCODED>> pendingPrepareIterator, Iterator<Map.Entry<KENCODED,VENCODED>> pendingCommitIterator, Set<KENCODED> initialProvidedKeys)
Constructor.
pendingPrepareIterator
- The iterator of pendingPreparependingCommitIterator
- The iterator of pendingCommitinitialProvidedKeys
- The initial value of provided keysprotected abstract Iterator<Map.Entry<KENCODED,VENCODED>> loadChunkFromStateStorage()
Load some part of state KVs from storage and returns iterator of cached data from storage.
protected abstract boolean isEndOfDataFromStorage()
Check whether end of data is reached from storage state KVs.
protected abstract K decodeKey(KENCODED key)
Decode key to convert encoded type of key to state key type.
key
- raw type of encoded keyprotected abstract V decodeValue(VENCODED value)
Decode value to convert encoded type of value to state value type.
value
- raw type of encoded valueprotected abstract boolean isTombstoneValue(VENCODED value)
Check whether the value is tombstone (deletion mark) value.
value
- the value to checkCopyright © 2019 The Apache Software Foundation. All Rights Reserved.