Package org.apache.flink.runtime.state
Interface KeyValueStateIterator
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
HeapKeyValueStateIterator
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 TypeMethodDescriptionvoidclose()booleanIndicates if current key starts a new key-group, i.e. belong to a different key-group than it's predecessor.booleanIndicates if current key starts a new k/v-state, i.e. belong to a different k/v-state than it's predecessor.booleanisValid()Check if the iterator is still valid.byte[]key()intkeyGroup()Returns the key-group for the current key.intReturns the Id of the K/V state to which the current key belongs.voidnext()Advances the iterator.byte[]value()
-
Method Details
-
next
Advances the iterator. Should only be called ifisValid()returned true. Valid flag can only change after callingnext().- 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 likekey(),value(), etc. as well asnext()should only be called if valid returned true. Should be checked after each call tonext()before accessing iterator state.- Returns:
- True iff this iterator is valid.
-
close
void close()- Specified by:
closein interfaceAutoCloseable
-