Interface KeyValueStateIterator

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
HeapKeyValueStateIterator

public interface KeyValueStateIterator extends AutoCloseable
Iterator that over all key-value state entries in a KeyedStateBackend. For use during snapshotting.

This is required to partition all states into contiguous key-groups. The resulting iteration sequence is ordered by (key-group, kv-state).

  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
    Indicates if current key starts a new key-group, i.e. belong to a different key-group than it's predecessor.
    boolean
    Indicates if current key starts a new k/v-state, i.e. belong to a different k/v-state than it's predecessor.
    boolean
    Check if the iterator is still valid.
    byte[]
    key()
     
    int
    Returns the key-group for the current key.
    int
    Returns the Id of the K/V state to which the current key belongs.
    void
    Advances the iterator.
    byte[]
     
  • Method Details

    • next

      void next() throws IOException
      Advances the iterator. Should only be called if isValid() returned true. Valid flag can only change after calling next().
      Throws:
      IOException
    • keyGroup

      int keyGroup()
      Returns the key-group for the current key.
    • key

      byte[] key()
    • value

      byte[] value()
    • kvStateId

      int kvStateId()
      Returns the Id of the K/V state to which the current key belongs.
    • isNewKeyValueState

      boolean isNewKeyValueState()
      Indicates if current key starts a new k/v-state, i.e. belong to a different k/v-state than it's predecessor.
      Returns:
      true iff the current key belong to a different k/v-state than it's predecessor.
    • isNewKeyGroup

      boolean isNewKeyGroup()
      Indicates if current key starts a new key-group, i.e. belong to a different key-group than it's predecessor.
      Returns:
      true iff the current key belong to a different key-group than it's predecessor.
    • isValid

      boolean isValid()
      Check if the iterator is still valid. Getters like key(), value(), etc. as well as next() should only be called if valid returned true. Should be checked after each call to next() before accessing iterator state.
      Returns:
      True iff this iterator is valid.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable