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
Fields Modifier and Type Field Description static intNO_CURRENT_KEY_GROUPstatic longNO_OFFSET_SET-
Fields inherited from class org.apache.flink.runtime.state.NonClosingCheckpointOutputStream
delegate
-
-
Constructor Summary
Constructors Constructor Description KeyedStateCheckpointOutputStream(CheckpointStateOutputStream delegate, KeyGroupRange keyGroupRange)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intgetCurrentKeyGroup()Returns the key group that is currently being written.KeyGroupsListgetKeyGroupList()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, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
NO_OFFSET_SET
public static final long NO_OFFSET_SET
- See Also:
- Constant Field Values
-
NO_CURRENT_KEY_GROUP
public static final int NO_CURRENT_KEY_GROUP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeyedStateCheckpointOutputStream
public KeyedStateCheckpointOutputStream(CheckpointStateOutputStream delegate, KeyGroupRange keyGroupRange)
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classNonClosingCheckpointOutputStream<KeyGroupsStateHandle>- Throws:
IOException
-
getKeyGroupList
public KeyGroupsList getKeyGroupList()
Returns a list of all key-groups which can be written to this stream.
-
startNewKeyGroup
public void startNewKeyGroup(int keyGroupId) throws IOExceptionUser 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.
-
-