Interface AsyncFSOutput
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
FanOutOneBlockAsyncDFSOutput,WrapperAsyncFSOutput
Interface for asynchronous filesystem output stream.
The implementation is not required to be thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionintbuffered()Return the current size of buffered data.voidclose()Close the file.flush(boolean sync) Flush the buffer out.org.apache.hadoop.hdfs.protocol.DatanodeInfo[]Return current pipeline.longReturns byteSize success synced to underlying filesystem.booleanisBroken()Whether the stream is broken.voidrecoverAndClose(CancelableProgressable reporter) The close method when error occurred.voidwrite(byte[] b) Just call write(b, 0, b.length).voidwrite(byte[] b, int off, int len) Copy the data into the buffer.voidwrite(ByteBuffer bb) Copy the data in the givenbbinto the buffer.voidwriteInt(int i) Write an int to the buffer.
-
Method Details
-
write
Just call write(b, 0, b.length).- See Also:
-
write
Copy the data into the buffer. Note that you need to callflush(boolean)to flush the buffer manually. -
writeInt
Write an int to the buffer. -
write
Copy the data in the givenbbinto the buffer. -
buffered
int buffered()Return the current size of buffered data. -
isBroken
boolean isBroken()Whether the stream is broken. -
getPipeline
org.apache.hadoop.hdfs.protocol.DatanodeInfo[] getPipeline()Return current pipeline. Empty array if no pipeline. -
flush
Flush the buffer out.- Parameters:
sync- persistent the data to device- Returns:
- A CompletableFuture that hold the acked length after flushing.
-
recoverAndClose
The close method when error occurred.- Throws:
IOException
-
close
Close the file. You should callrecoverAndClose(CancelableProgressable)if this method throws an exception.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getSyncedLength
long getSyncedLength()Returns byteSize success synced to underlying filesystem.
-