public class FileMergingCheckpointStateOutputStream extends FsCheckpointStreamFactory.FsCheckpointStateOutputStream
CheckpointStateOutputStream that writes into a segment of a file and returns a SegmentFileStateHandle upon closing. Multiple FileMergingCheckpointStateOutputStream
objects can reuse the same underlying file, so that the checkpoint files are merged.
Important: This implementation is NOT thread-safe. Multiple data streams multiplexing the same file should NOT write concurrently. Instead, it is expected that only after one data stream is closed, will other data streams reuse and write to the same underlying file.
| Modifier and Type | Class and Description |
|---|---|
static interface |
FileMergingCheckpointStateOutputStream.FileMergingSnapshotManagerProxy
A proxy of the
FileMergingSnapshotManager that owns this FileMergingCheckpointStateOutputStream, with the interfaces for dealing with physical files. |
| Constructor and Description |
|---|
FileMergingCheckpointStateOutputStream(int bufferSize,
FileMergingCheckpointStateOutputStream.FileMergingSnapshotManagerProxy fileMergingSnapshotManagerProxy) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This method throws no exception if the close fails, but only logs the error.
|
SegmentFileStateHandle |
closeAndGetHandle()
Closes the stream and gets a state handle that can create an input stream producing the data
written to this stream.
|
void |
flush()
Flush buffers to file if their size is above
FsCheckpointStreamFactory.FsCheckpointStateOutputStream.localStateThreshold. |
void |
flushToFile() |
org.apache.flink.core.fs.Path |
getFilePath() |
long |
getPos() |
void |
sync() |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
isClosedwritepublic FileMergingCheckpointStateOutputStream(int bufferSize,
FileMergingCheckpointStateOutputStream.FileMergingSnapshotManagerProxy fileMergingSnapshotManagerProxy)
public long getPos()
throws IOException
getPos in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreamIOExceptionpublic void flush()
throws IOException
FsCheckpointStreamFactory.FsCheckpointStateOutputStreamFsCheckpointStreamFactory.FsCheckpointStateOutputStream.localStateThreshold.flush in interface Flushableflush in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreamIOExceptionpublic void sync()
throws IOException
sync in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreamIOException@Nullable public SegmentFileStateHandle closeAndGetHandle() throws IOException
CheckpointStateOutputStreamThis closing must be called (also when the caller is not interested in the handle) to
successfully close the stream and retain the produced resource. In contrast, the CheckpointStateOutputStream.close() method removes the target resource when called.
closeAndGetHandle in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreamIOException - Thrown, if the stream cannot be closed.public void close()
FsCheckpointStreamFactory.FsCheckpointStateOutputStream.close().close in interface Closeableclose in interface AutoCloseableclose in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreampublic void flushToFile()
throws IOException
flushToFile in class FsCheckpointStreamFactory.FsCheckpointStateOutputStreamIOException@VisibleForTesting @Nullable public org.apache.flink.core.fs.Path getFilePath()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.