Package org.apache.flink.runtime.state
Class KeyedStateCheckpointOutputStream
java.lang.Object
java.io.OutputStream
org.apache.flink.runtime.state.NonClosingCheckpointOutputStream<KeyGroupsStateHandle>
org.apache.flink.runtime.state.KeyedStateCheckpointOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
@PublicEvolving
public final class KeyedStateCheckpointOutputStream
extends NonClosingCheckpointOutputStream<KeyGroupsStateHandle>
Checkpoint output stream that allows to write raw keyed state in a partitioned way, split into
key-groups.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final longFields inherited from class org.apache.flink.runtime.state.NonClosingCheckpointOutputStream
delegate -
Constructor Summary
ConstructorsConstructorDescriptionKeyedStateCheckpointOutputStream(CheckpointStateOutputStream delegate, KeyGroupRange keyGroupRange) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intReturns the key group that is currently being written.Returns a list of all key-groups which can be written to this stream.booleanisKeyGroupAlreadyFinished(int keyGroupId) Returns true if the key group is already completely written and immutable.booleanisKeyGroupAlreadyStarted(int keyGroupId) Returns true, if the key group with the given id was already started.voidstartNewKeyGroup(int keyGroupId) User code can call this method to signal that it begins to write a new key group with the given key group id.Methods inherited from class org.apache.flink.runtime.state.NonClosingCheckpointOutputStream
acquireLease, flush, write, write, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
NO_OFFSET_SET
public static final long NO_OFFSET_SET- See Also:
-
NO_CURRENT_KEY_GROUP
public static final int NO_CURRENT_KEY_GROUP- See Also:
-
-
Constructor Details
-
KeyedStateCheckpointOutputStream
public KeyedStateCheckpointOutputStream(CheckpointStateOutputStream delegate, KeyGroupRange keyGroupRange)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classNonClosingCheckpointOutputStream<KeyGroupsStateHandle>- Throws:
IOException
-
getKeyGroupList
Returns a list of all key-groups which can be written to this stream. -
startNewKeyGroup
User code can call this method to signal that it begins to write a new key group with the given key group id. This id must be within theKeyGroupsListprovided by the stream. Each key-group can only be started once and is considered final/immutable as soon as this method is called again.- Throws:
IOException
-
isKeyGroupAlreadyStarted
public boolean isKeyGroupAlreadyStarted(int keyGroupId) Returns true, if the key group with the given id was already started. The key group might not yet be finished, if it's id is equal to the return value ofgetCurrentKeyGroup(). -
isKeyGroupAlreadyFinished
public boolean isKeyGroupAlreadyFinished(int keyGroupId) Returns true if the key group is already completely written and immutable. It was started and since then another key group has been started. -
getCurrentKeyGroup
public int getCurrentKeyGroup()Returns the key group that is currently being written. The key group was started but not yet finished, i.e. data can still be added. If no key group was started, this returnsNO_CURRENT_KEY_GROUP.
-