Package org.apache.storm.state
Class BaseBinaryStateIterator<K,V>
- java.lang.Object
-
- org.apache.storm.state.BaseStateIterator<K,V,byte[],byte[]>
-
- org.apache.storm.state.BaseBinaryStateIterator<K,V>
-
- Direct Known Subclasses:
RedisKeyValueStateIterator
public abstract class BaseBinaryStateIterator<K,V> extends BaseStateIterator<K,V,byte[],byte[]>
Base implementation of iterator overKeyValueState
which encoded types of key and value are both binary type.
-
-
Constructor Summary
Constructors Constructor Description BaseBinaryStateIterator(Iterator<Map.Entry<byte[],byte[]>> pendingPrepareIterator, Iterator<Map.Entry<byte[],byte[]>> pendingCommitIterator)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description protected abstract K
decodeKey(byte[] key)
Decode key to convert byte array to state key type.protected abstract V
decodeValue(byte[] value)
Decode value to convert byte array to state value type.protected abstract boolean
isEndOfDataFromStorage()
Check whether end of data is reached from storage state KVs.protected abstract boolean
isTombstoneValue(byte[] value)
Check whether the value is tombstone (deletion mark) value.protected abstract Iterator<Map.Entry<byte[],byte[]>>
loadChunkFromStateStorage()
Load some part of state KVs from storage and returns iterator of cached data from storage.-
Methods inherited from class org.apache.storm.state.BaseStateIterator
hasNext, next, remove
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
BaseBinaryStateIterator
public BaseBinaryStateIterator(Iterator<Map.Entry<byte[],byte[]>> pendingPrepareIterator, Iterator<Map.Entry<byte[],byte[]>> pendingCommitIterator)
Constructor.- Parameters:
pendingPrepareIterator
- The iterator of pendingPreparependingCommitIterator
- The iterator of pendingCommit
-
-
Method Detail
-
loadChunkFromStateStorage
protected abstract Iterator<Map.Entry<byte[],byte[]>> loadChunkFromStateStorage()
Load some part of state KVs from storage and returns iterator of cached data from storage.- Specified by:
loadChunkFromStateStorage
in classBaseStateIterator<K,V,byte[],byte[]>
- Returns:
- Iterator of loaded state KVs
-
isEndOfDataFromStorage
protected abstract boolean isEndOfDataFromStorage()
Check whether end of data is reached from storage state KVs.- Specified by:
isEndOfDataFromStorage
in classBaseStateIterator<K,V,byte[],byte[]>
- Returns:
- whether end of data is reached from storage state KVs
-
decodeKey
protected abstract K decodeKey(byte[] key)
Decode key to convert byte array to state key type.- Specified by:
decodeKey
in classBaseStateIterator<K,V,byte[],byte[]>
- Parameters:
key
- byte array encoded key- Returns:
- Decoded value of key
-
decodeValue
protected abstract V decodeValue(byte[] value)
Decode value to convert byte array to state value type.- Specified by:
decodeValue
in classBaseStateIterator<K,V,byte[],byte[]>
- Parameters:
value
- byte array encoded value- Returns:
- Decoded value of value
-
isTombstoneValue
protected abstract boolean isTombstoneValue(byte[] value)
Check whether the value is tombstone (deletion mark) value.- Specified by:
isTombstoneValue
in classBaseStateIterator<K,V,byte[],byte[]>
- Parameters:
value
- the value to check- Returns:
- true if the value is tombstone, false otherwise
-
-