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 K
decodeKey(byte[] key)
Decode key to convert byte array to state key type.protected V
decodeValue(byte[] value)
Decode value to convert byte array to state value type.protected boolean
isEndOfDataFromStorage()
Check whether end of data is reached from storage state KVs.protected boolean
isTombstoneValue(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:BaseBinaryStateIterator
Load some part of state KVs from storage and returns iterator of cached data from storage.- Specified by:
loadChunkFromStateStorage
in classBaseBinaryStateIterator<K,V>
- Returns:
- Iterator of loaded state KVs
-
isEndOfDataFromStorage
protected boolean isEndOfDataFromStorage()
Description copied from class:BaseBinaryStateIterator
Check whether end of data is reached from storage state KVs.- Specified by:
isEndOfDataFromStorage
in classBaseBinaryStateIterator<K,V>
- Returns:
- whether end of data is reached from storage state KVs
-
decodeKey
protected K decodeKey(byte[] key)
Description copied from class:BaseBinaryStateIterator
Decode key to convert byte array to state key type.- Specified by:
decodeKey
in classBaseBinaryStateIterator<K,V>
- Parameters:
key
- byte array encoded key- Returns:
- Decoded value of key
-
decodeValue
protected V decodeValue(byte[] value)
Description copied from class:BaseBinaryStateIterator
Decode value to convert byte array to state value type.- Specified by:
decodeValue
in classBaseBinaryStateIterator<K,V>
- Parameters:
value
- byte array encoded value- Returns:
- Decoded value of value
-
isTombstoneValue
protected boolean isTombstoneValue(byte[] value)
Description copied from class:BaseBinaryStateIterator
Check whether the value is tombstone (deletion mark) value.- Specified by:
isTombstoneValue
in classBaseBinaryStateIterator<K,V>
- Parameters:
value
- the value to check- Returns:
- true if the value is tombstone, false otherwise
-
-