Class HeapKeyValueStateIterator
- java.lang.Object
-
- org.apache.flink.runtime.state.heap.HeapKeyValueStateIterator
-
- All Implemented Interfaces:
AutoCloseable,KeyValueStateIterator
@Internal @NotThreadSafe public final class HeapKeyValueStateIterator extends Object implements KeyValueStateIterator
AKeyValueStateIteratorover Heap backend snapshot resources.
-
-
Constructor Summary
Constructors Constructor Description HeapKeyValueStateIterator(KeyGroupRange keyGroupRange, org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer, int totalKeyGroups, Map<org.apache.flink.runtime.state.heap.StateUID,Integer> stateNamesToId, Map<org.apache.flink.runtime.state.heap.StateUID,StateSnapshot> stateSnapshots)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisNewKeyGroup()Indicates if current key starts a new key-group, i.e. belong to a different key-group than it's predecessor.booleanisNewKeyValueState()Indicates 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.intkvStateId()Returns the Id of the K/V state to which the current key belongs.voidnext()Advances the iterator.byte[]value()
-
-
-
Constructor Detail
-
HeapKeyValueStateIterator
public HeapKeyValueStateIterator(@Nonnull KeyGroupRange keyGroupRange, @Nonnull org.apache.flink.api.common.typeutils.TypeSerializer<?> keySerializer, @Nonnegative int totalKeyGroups, @Nonnull Map<org.apache.flink.runtime.state.heap.StateUID,Integer> stateNamesToId, @Nonnull Map<org.apache.flink.runtime.state.heap.StateUID,StateSnapshot> stateSnapshots) throws IOException- Throws:
IOException
-
-
Method Detail
-
isValid
public boolean isValid()
Description copied from interface:KeyValueStateIteratorCheck if the iterator is still valid. Getters likeKeyValueStateIterator.key(),KeyValueStateIterator.value(), etc. as well asKeyValueStateIterator.next()should only be called if valid returned true. Should be checked after each call toKeyValueStateIterator.next()before accessing iterator state.- Specified by:
isValidin interfaceKeyValueStateIterator- Returns:
- True iff this iterator is valid.
-
isNewKeyValueState
public boolean isNewKeyValueState()
Description copied from interface:KeyValueStateIteratorIndicates if current key starts a new k/v-state, i.e. belong to a different k/v-state than it's predecessor.- Specified by:
isNewKeyValueStatein interfaceKeyValueStateIterator- Returns:
- true iff the current key belong to a different k/v-state than it's predecessor.
-
isNewKeyGroup
public boolean isNewKeyGroup()
Description copied from interface:KeyValueStateIteratorIndicates if current key starts a new key-group, i.e. belong to a different key-group than it's predecessor.- Specified by:
isNewKeyGroupin interfaceKeyValueStateIterator- Returns:
- true iff the current key belong to a different key-group than it's predecessor.
-
keyGroup
public int keyGroup()
Description copied from interface:KeyValueStateIteratorReturns the key-group for the current key.- Specified by:
keyGroupin interfaceKeyValueStateIterator
-
kvStateId
public int kvStateId()
Description copied from interface:KeyValueStateIteratorReturns the Id of the K/V state to which the current key belongs.- Specified by:
kvStateIdin interfaceKeyValueStateIterator
-
next
public void next() throws IOExceptionDescription copied from interface:KeyValueStateIteratorAdvances the iterator. Should only be called ifKeyValueStateIterator.isValid()returned true. Valid flag can only change after callingKeyValueStateIterator.next().- Specified by:
nextin interfaceKeyValueStateIterator- Throws:
IOException
-
key
public byte[] key()
- Specified by:
keyin interfaceKeyValueStateIterator
-
value
public byte[] value()
- Specified by:
valuein interfaceKeyValueStateIterator
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceKeyValueStateIterator
-
-