@Internal @NotThreadSafe public final class HeapKeyValueStateIterator extends Object implements KeyValueStateIterator
KeyValueStateIterator
over Heap backend snapshot
resources.Constructor and Description |
---|
HeapKeyValueStateIterator(KeyGroupRange keyGroupRange,
TypeSerializer<?> keySerializer,
int totalKeyGroups,
Map<org.apache.flink.runtime.state.heap.StateUID,Integer> stateNamesToId,
Map<org.apache.flink.runtime.state.heap.StateUID,StateSnapshot> stateSnapshots) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
isNewKeyGroup()
Indicates if current key starts a new key-group, i.e.
|
boolean |
isNewKeyValueState()
Indicates if current key starts a new k/v-state, i.e.
|
boolean |
isValid()
Check if the iterator is still valid.
|
byte[] |
key() |
int |
keyGroup()
Returns the key-group for the current key.
|
int |
kvStateId()
Returns the Id of the K/V state to which the current key belongs.
|
void |
next()
Advances the iterator.
|
byte[] |
value() |
public HeapKeyValueStateIterator(@Nonnull KeyGroupRange keyGroupRange, @Nonnull 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
IOException
public boolean isValid()
KeyValueStateIterator
KeyValueStateIterator.key()
, KeyValueStateIterator.value()
, etc. as
well as KeyValueStateIterator.next()
should only be called if valid returned true. Should be checked after
each call to KeyValueStateIterator.next()
before accessing iterator state.isValid
in interface KeyValueStateIterator
public boolean isNewKeyValueState()
KeyValueStateIterator
isNewKeyValueState
in interface KeyValueStateIterator
public boolean isNewKeyGroup()
KeyValueStateIterator
isNewKeyGroup
in interface KeyValueStateIterator
public int keyGroup()
KeyValueStateIterator
keyGroup
in interface KeyValueStateIterator
public int kvStateId()
KeyValueStateIterator
kvStateId
in interface KeyValueStateIterator
public void next() throws IOException
KeyValueStateIterator
KeyValueStateIterator.isValid()
returned true. Valid flag
can only change after calling KeyValueStateIterator.next()
.next
in interface KeyValueStateIterator
IOException
public byte[] key()
key
in interface KeyValueStateIterator
public byte[] value()
value
in interface KeyValueStateIterator
public void close()
close
in interface AutoCloseable
close
in interface KeyValueStateIterator
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.