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 int
NO_CURRENT_KEY_GROUP
static long
NO_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 void
close()
int
getCurrentKeyGroup()
Returns the key group that is currently being written.KeyGroupsList
getKeyGroupList()
Returns a list of all key-groups which can be written to this stream.boolean
isKeyGroupAlreadyFinished(int keyGroupId)
Returns true if the key group is already completely written and immutable.boolean
isKeyGroupAlreadyStarted(int keyGroupId)
Returns true, if the key group with the given id was already started.void
startNewKeyGroup(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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in 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 IOException
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 theKeyGroupsList
provided 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
.
-
-