Java Code Examples for org.apache.flink.fs.s3.common.utils.RefCountedBufferingFileStream#restore()

The following examples show how to use org.apache.flink.fs.s3.common.utils.RefCountedBufferingFileStream#restore() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: S3RecoverableFsDataOutputStream.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static RefCountedBufferingFileStream boundedBufferingFileStream(
		final FunctionWithException<File, RefCountedFile, IOException> tmpFileCreator,
		final Optional<File> incompletePart) throws IOException {

	if (!incompletePart.isPresent()) {
		return RefCountedBufferingFileStream.openNew(tmpFileCreator);
	}

	final File file = incompletePart.get();
	return RefCountedBufferingFileStream.restore(tmpFileCreator, file);
}
 
Example 2
Source File: S3RecoverableFsDataOutputStreamTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private S3RecoverableFsDataOutputStream reopenStreamUnderTestAfterRecovery() throws IOException {
	final long bytesBeforeCurrentPart = multipartUploadUnderTest.numBytes;
	final Optional<File> incompletePart = multipartUploadUnderTest.getIncompletePart();

	RefCountedBufferingFileStream fileStream = RefCountedBufferingFileStream.restore(fileProvider, incompletePart.get());
	multipartUploadUnderTest.discardUnpersistedData();

	return new S3RecoverableFsDataOutputStream(
			multipartUploadUnderTest,
			fileProvider,
			fileStream,
			USER_DEFINED_MIN_PART_SIZE,
			bytesBeforeCurrentPart
	);
}
 
Example 3
Source File: S3RecoverableFsDataOutputStream.java    From flink with Apache License 2.0 5 votes vote down vote up
private static RefCountedBufferingFileStream boundedBufferingFileStream(
		final FunctionWithException<File, RefCountedFile, IOException> tmpFileCreator,
		final Optional<File> incompletePart) throws IOException {

	if (!incompletePart.isPresent()) {
		return RefCountedBufferingFileStream.openNew(tmpFileCreator);
	}

	final File file = incompletePart.get();
	return RefCountedBufferingFileStream.restore(tmpFileCreator, file);
}
 
Example 4
Source File: S3RecoverableFsDataOutputStreamTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private S3RecoverableFsDataOutputStream reopenStreamUnderTestAfterRecovery() throws IOException {
	final long bytesBeforeCurrentPart = multipartUploadUnderTest.numBytes;
	final Optional<File> incompletePart = multipartUploadUnderTest.getIncompletePart();

	RefCountedBufferingFileStream fileStream = RefCountedBufferingFileStream.restore(fileProvider, incompletePart.get());
	multipartUploadUnderTest.discardUnpersistedData();

	return new S3RecoverableFsDataOutputStream(
			multipartUploadUnderTest,
			fileProvider,
			fileStream,
			USER_DEFINED_MIN_PART_SIZE,
			bytesBeforeCurrentPart
	);
}
 
Example 5
Source File: S3RecoverableFsDataOutputStream.java    From flink with Apache License 2.0 5 votes vote down vote up
private static RefCountedBufferingFileStream boundedBufferingFileStream(
		final FunctionWithException<File, RefCountedFileWithStream, IOException> tmpFileCreator,
		final Optional<File> incompletePart) throws IOException {

	if (!incompletePart.isPresent()) {
		return RefCountedBufferingFileStream.openNew(tmpFileCreator);
	}

	final File file = incompletePart.get();
	return RefCountedBufferingFileStream.restore(tmpFileCreator, file);
}
 
Example 6
Source File: S3RecoverableFsDataOutputStreamTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private S3RecoverableFsDataOutputStream reopenStreamUnderTestAfterRecovery() throws IOException {
	final long bytesBeforeCurrentPart = multipartUploadUnderTest.numBytes;
	final Optional<File> incompletePart = multipartUploadUnderTest.getIncompletePart();

	RefCountedBufferingFileStream fileStream = RefCountedBufferingFileStream.restore(fileProvider, incompletePart.get());
	multipartUploadUnderTest.discardUnpersistedData();

	return new S3RecoverableFsDataOutputStream(
			multipartUploadUnderTest,
			fileProvider,
			fileStream,
			USER_DEFINED_MIN_PART_SIZE,
			bytesBeforeCurrentPart
	);
}