Class ReplicaOutputStreams

java.lang.Object
org.apache.hadoop.hdfs.server.datanode.fsdataset.ReplicaOutputStreams
All Implemented Interfaces:
Closeable, AutoCloseable

public class ReplicaOutputStreams extends Object implements Closeable
Contains the output streams for the data and checksum of a replica.
  • 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

      public FileDescriptor getOutFd()
    • getDataOut

      public OutputStream getDataOut()
      Returns:
      the data output stream.
    • getChecksumOut

      public OutputStream 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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • closeDataStream

      public void closeDataStream() throws IOException
      Throws:
      IOException
    • syncDataOut

      public void syncDataOut() throws IOException
      Sync the data stream if it supports it.
      Throws:
      IOException
    • syncChecksumOut

      public void syncChecksumOut() throws IOException
      Sync the checksum stream if it supports it.
      Throws:
      IOException
    • flushDataOut

      public void flushDataOut() throws IOException
      Flush the data stream if it supports it.
      Throws:
      IOException
    • flushChecksumOut

      public void flushChecksumOut() throws IOException
      Flush the checksum stream if it supports it.
      Throws:
      IOException
    • writeDataToDisk

      public void writeDataToDisk(byte[] b, int off, int len) throws IOException
      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