Package org.apache.storm.redis.state
Class RedisKeyValueStateIterator<K,V>
java.lang.Object
org.apache.storm.state.BaseStateIterator<K,V,byte[],byte[]>
org.apache.storm.state.BaseBinaryStateIterator<K,V>
org.apache.storm.redis.state.RedisKeyValueStateIterator<K,V>
An iterator over
RedisKeyValueState.-
Constructor Summary
ConstructorsConstructorDescriptionRedisKeyValueStateIterator(byte[] namespace, RedisCommandsInstanceContainer container, Iterator<Map.Entry<byte[], byte[]>> pendingPrepareIterator, Iterator<Map.Entry<byte[], byte[]>> pendingCommitIterator, int chunkSize, Serializer<K> keySerializer, Serializer<V> valueSerializer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected KdecodeKey(byte[] key) Decode key to convert byte array to state key type.protected VdecodeValue(byte[] value) Decode value to convert byte array to state value type.protected booleanCheck whether end of data is reached from storage state KVs.protected booleanisTombstoneValue(byte[] value) Check whether the value is tombstone (deletion mark) value.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, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
RedisKeyValueStateIterator
public RedisKeyValueStateIterator(byte[] namespace, RedisCommandsInstanceContainer container, Iterator<Map.Entry<byte[], byte[]>> pendingPrepareIterator, Iterator<Map.Entry<byte[], byte[]>> pendingCommitIterator, int chunkSize, Serializer<K> keySerializer, Serializer<V> valueSerializer) Constructor.- Parameters:
namespace- The namespace of Statecontainer- The instance of RedisCommandsInstanceContainerpendingPrepareIterator- The iterator of pendingPreparependingCommitIterator- The iterator of pendingCommitchunkSize- The size of chunk to get entries from RediskeySerializer- The serializer of keyvalueSerializer- The serializer of value
-
-
Method Details
-
loadChunkFromStateStorage
Description copied from class:BaseBinaryStateIteratorLoad some part of state KVs from storage and returns iterator of cached data from storage.- Specified by:
loadChunkFromStateStoragein classBaseBinaryStateIterator<K,V> - Returns:
- Iterator of loaded state KVs
-
isEndOfDataFromStorage
protected boolean isEndOfDataFromStorage()Description copied from class:BaseBinaryStateIteratorCheck whether end of data is reached from storage state KVs.- Specified by:
isEndOfDataFromStoragein classBaseBinaryStateIterator<K,V> - Returns:
- whether end of data is reached from storage state KVs
-
decodeKey
Description copied from class:BaseBinaryStateIteratorDecode key to convert byte array to state key type.- Specified by:
decodeKeyin classBaseBinaryStateIterator<K,V> - Parameters:
key- byte array encoded key- Returns:
- Decoded value of key
-
decodeValue
Description copied from class:BaseBinaryStateIteratorDecode value to convert byte array to state value type.- Specified by:
decodeValuein classBaseBinaryStateIterator<K,V> - Parameters:
value- byte array encoded value- Returns:
- Decoded value of value
-
isTombstoneValue
protected boolean isTombstoneValue(byte[] value) Description copied from class:BaseBinaryStateIteratorCheck whether the value is tombstone (deletion mark) value.- Specified by:
isTombstoneValuein classBaseBinaryStateIterator<K,V> - Parameters:
value- the value to check- Returns:
- true if the value is tombstone, false otherwise
-