Class ReplicaOutputStreams
java.lang.Object
org.apache.hadoop.hdfs.server.datanode.fsdataset.ReplicaOutputStreams
- All Implemented Interfaces:
Closeable,AutoCloseable
Contains the output streams for the data and checksum of a replica.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReplicaOutputStreams(OutputStream dataOut, OutputStream checksumOut, org.apache.hadoop.util.DataChecksum checksum, FsVolumeSpi volume, FileIoProvider fileIoProvider) Create an object with a data output stream, a checksum output stream and a checksum. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidvoiddropCacheBehindWrites(String identifier, long offset, long len, int flags) voidFlush the checksum stream if it supports it.voidFlush the data stream if it supports it.org.apache.hadoop.util.DataChecksumgetOutFd()booleanvoidSync the checksum stream if it supports it.voidSync the data stream if it supports it.voidsyncFileRangeIfPossible(long offset, long nbytes, int flags) voidwriteDataToDisk(byte[] b, int off, int len)
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
ReplicaOutputStreams
public ReplicaOutputStreams(OutputStream dataOut, OutputStream checksumOut, org.apache.hadoop.util.DataChecksum checksum, FsVolumeSpi volume, FileIoProvider fileIoProvider) Create an object with a data output stream, a checksum output stream and a checksum.
-
-
Method Details
-
getOutFd
-
getDataOut
- Returns:
- the data output stream.
-
getChecksumOut
- Returns:
- the checksum output stream.
-
getChecksum
public org.apache.hadoop.util.DataChecksum getChecksum()- Returns:
- the checksum.
-
isTransientStorage
public boolean isTransientStorage()- Returns:
- is writing to a transient storage?
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
closeDataStream
- Throws:
IOException
-
syncDataOut
Sync the data stream if it supports it.- Throws:
IOException
-
syncChecksumOut
Sync the checksum stream if it supports it.- Throws:
IOException
-
flushDataOut
Flush the data stream if it supports it.- Throws:
IOException
-
flushChecksumOut
Flush the checksum stream if it supports it.- Throws:
IOException
-
writeDataToDisk
- Throws:
IOException
-
syncFileRangeIfPossible
public void syncFileRangeIfPossible(long offset, long nbytes, int flags) throws org.apache.hadoop.io.nativeio.NativeIOException - Throws:
org.apache.hadoop.io.nativeio.NativeIOException
-
dropCacheBehindWrites
public void dropCacheBehindWrites(String identifier, long offset, long len, int flags) throws org.apache.hadoop.io.nativeio.NativeIOException - Throws:
org.apache.hadoop.io.nativeio.NativeIOException
-