Class BaseStateIterator<K,V,KENCODEDT,VENCODEDT>

java.lang.Object
org.apache.storm.state.BaseStateIterator<K,V,KENCODEDT,VENCODEDT>
All Implemented Interfaces:
Iterator<Map.Entry<K,V>>
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 Details

  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<K>
    • next

      public Map.Entry<K,V> next()
      Specified by:
      next in interface Iterator<K>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<K>
    • loadChunkFromStateStorage

      protected abstract Iterator<Map.Entry<KENCODEDT,VENCODEDT>> loadChunkFromStateStorage()
      Load some part of state KVs from storage and returns iterator of cached data from storage.
      Returns:
      Iterator of loaded state KVs
    • isEndOfDataFromStorage

      protected 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
    • decodeKey

      protected abstract K decodeKey(KENCODEDT key)
      Decode key to convert encoded type of key to state key type.
      Parameters:
      key - raw type of encoded key
      Returns:
      Decoded value of key
    • decodeValue

      protected abstract V decodeValue(VENCODEDT value)
      Decode value to convert encoded type of value to state value type.
      Parameters:
      value - raw type of encoded value
      Returns:
      Decoded value of value
    • isTombstoneValue

      protected abstract boolean isTombstoneValue(VENCODEDT value)
      Check whether the value is tombstone (deletion mark) value.
      Parameters:
      value - the value to check
      Returns:
      true if the value is tombstone, false otherwise