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>
-
public class RedisKeyValueStateIterator<K,V> extends BaseBinaryStateIterator<K,V>
An iterator overRedisKeyValueState.
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 booleanisEndOfDataFromStorage()Check whether end of data is reached from storage state KVs.protected booleanisTombstoneValue(byte[] value)Check whether the value is tombstone (deletion mark) value.protected 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
-
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 Detail
-
loadChunkFromStateStorage
protected Iterator<Map.Entry<byte[],byte[]>> 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
protected K decodeKey(byte[] key)
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
protected V decodeValue(byte[] value)
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
-
-