IN - The type of input elements.@Internal public class FileWriter<IN> extends Object implements org.apache.flink.api.connector.sink.SinkWriter<IN,FileSinkCommittable,FileWriterBucketState>, org.apache.flink.api.connector.sink.Sink.ProcessingTimeService.ProcessingTimeCallback
| Constructor and Description |
|---|
FileWriter(org.apache.flink.core.fs.Path basePath,
org.apache.flink.streaming.api.functions.sink.filesystem.BucketAssigner<IN,String> bucketAssigner,
FileWriterBucketFactory<IN> bucketFactory,
org.apache.flink.streaming.api.functions.sink.filesystem.BucketWriter<IN,String> bucketWriter,
org.apache.flink.streaming.api.functions.sink.filesystem.RollingPolicy<IN,String> rollingPolicy,
org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig outputFileConfig,
org.apache.flink.api.connector.sink.Sink.ProcessingTimeService processingTimeService,
long bucketCheckInterval)
A constructor creating a new empty bucket manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
initializeState(List<FileWriterBucketState> bucketStates)
Initializes the state after recovery from a failure.
|
void |
onProcessingTime(long time) |
List<FileSinkCommittable> |
prepareCommit(boolean flush) |
List<FileWriterBucketState> |
snapshotState() |
void |
write(IN element,
org.apache.flink.api.connector.sink.SinkWriter.Context context) |
public FileWriter(org.apache.flink.core.fs.Path basePath,
org.apache.flink.streaming.api.functions.sink.filesystem.BucketAssigner<IN,String> bucketAssigner,
FileWriterBucketFactory<IN> bucketFactory,
org.apache.flink.streaming.api.functions.sink.filesystem.BucketWriter<IN,String> bucketWriter,
org.apache.flink.streaming.api.functions.sink.filesystem.RollingPolicy<IN,String> rollingPolicy,
org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig outputFileConfig,
org.apache.flink.api.connector.sink.Sink.ProcessingTimeService processingTimeService,
long bucketCheckInterval)
basePath - The base path for our buckets.bucketAssigner - The BucketAssigner provided by the user.bucketFactory - The FileWriterBucketFactory to be used to create buckets.bucketWriter - The BucketWriter to be used when writing data.rollingPolicy - The RollingPolicy as specified by the user.public void initializeState(List<FileWriterBucketState> bucketStates) throws IOException
During this process:
bucketStates - the state holding recovered state about active buckets.IOException - if anything goes wrong during retrieving the state or restoring/committing of any
in-progress/pending part filespublic void write(IN element, org.apache.flink.api.connector.sink.SinkWriter.Context context) throws IOException
write in interface org.apache.flink.api.connector.sink.SinkWriter<IN,FileSinkCommittable,FileWriterBucketState>IOExceptionpublic List<FileSinkCommittable> prepareCommit(boolean flush) throws IOException
prepareCommit in interface org.apache.flink.api.connector.sink.SinkWriter<IN,FileSinkCommittable,FileWriterBucketState>IOExceptionpublic List<FileWriterBucketState> snapshotState() throws IOException
snapshotState in interface org.apache.flink.api.connector.sink.SinkWriter<IN,FileSinkCommittable,FileWriterBucketState>IOExceptionpublic void close()
close in interface AutoCloseablepublic void onProcessingTime(long time)
throws IOException
onProcessingTime in interface org.apache.flink.api.connector.sink.Sink.ProcessingTimeService.ProcessingTimeCallbackIOExceptionCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.