Package org.apache.storm.state
Class BaseStateIterator<K,V,KENCODEDT,VENCODEDT>   
java.lang.Object
org.apache.storm.state.BaseStateIterator<K,V,KENCODEDT,VENCODEDT>   
- Direct Known Subclasses:
- BaseBinaryStateIterator
public abstract class BaseStateIterator<K,V,KENCODEDT,VENCODEDT>   
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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract KDecode key to convert encoded type of key to state key type.protected abstract VdecodeValue(VENCODEDT value) Decode value to convert encoded type of value to state value type.booleanhasNext()protected abstract booleanCheck whether end of data is reached from storage state KVs.protected abstract booleanisTombstoneValue(VENCODEDT 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.next()voidremove()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining
- 
Constructor Details- 
BaseStateIteratorpublic BaseStateIterator(Iterator<Map.Entry<KENCODEDT, VENCODEDT>> pendingPrepareIterator, Iterator<Map.Entry<KENCODEDT, VENCODEDT>> pendingCommitIterator, Set<KENCODEDT> initialProvidedKeys) Constructor.- Parameters:
- pendingPrepareIterator- The iterator of pendingPrepare
- pendingCommitIterator- The iterator of pendingCommit
- initialProvidedKeys- The initial value of provided keys
 
 
- 
- 
Method Details- 
hasNextpublic boolean hasNext()
- 
next
- 
removepublic void remove()
- 
loadChunkFromStateStorageLoad some part of state KVs from storage and returns iterator of cached data from storage.- Returns:
- Iterator of loaded state KVs
 
- 
isEndOfDataFromStorageprotected abstract boolean isEndOfDataFromStorage()Check whether end of data is reached from storage state KVs.- Returns:
- whether end of data is reached from storage state KVs
 
- 
decodeKeyDecode key to convert encoded type of key to state key type.- Parameters:
- key- raw type of encoded key
- Returns:
- Decoded value of key
 
- 
decodeValueDecode value to convert encoded type of value to state value type.- Parameters:
- value- raw type of encoded value
- Returns:
- Decoded value of value
 
- 
isTombstoneValueCheck whether the value is tombstone (deletion mark) value.- Parameters:
- value- the value to check
- Returns:
- true if the value is tombstone, false otherwise
 
 
-