Class ByteWritesTrackingDirectoryWrapper

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public final class ByteWritesTrackingDirectoryWrapper
    extends FilterDirectory
    FilterDirectory that tracks write amplification factor
    • Field Detail

      • flushedBytes

        private final java.util.concurrent.atomic.AtomicLong flushedBytes
      • mergedBytes

        private final java.util.concurrent.atomic.AtomicLong mergedBytes
      • trackTempOutput

        public final boolean trackTempOutput
    • Constructor Detail

      • ByteWritesTrackingDirectoryWrapper

        public ByteWritesTrackingDirectoryWrapper​(Directory in)
      • ByteWritesTrackingDirectoryWrapper

        public ByteWritesTrackingDirectoryWrapper​(Directory in,
                                                  boolean trackTempOutput)
        Constructor with option to track tempOutput
        Parameters:
        in - input Directory
        trackTempOutput - if true, will also track temporary outputs created by this directory
    • Method Detail

      • createOutput

        public IndexOutput createOutput​(java.lang.String name,
                                        IOContext ioContext)
                                 throws java.io.IOException
        Description copied from class: Directory
        Creates a new, empty file in the directory and returns an IndexOutput instance for appending data to this file.

        This method must throw FileAlreadyExistsException if the file already exists.

        Overrides:
        createOutput in class FilterDirectory
        Parameters:
        name - the name of the file to create.
        Throws:
        java.io.IOException - in case of I/O error
      • createTempOutput

        public IndexOutput createTempOutput​(java.lang.String prefix,
                                            java.lang.String suffix,
                                            IOContext ioContext)
                                     throws java.io.IOException
        Description copied from class: Directory
        Creates a new, empty, temporary file in the directory and returns an IndexOutput instance for appending data to this file.

        The temporary file name (accessible via IndexOutput.getName()) will start with prefix, end with suffix and have a reserved file extension .tmp.

        Overrides:
        createTempOutput in class FilterDirectory
        Throws:
        java.io.IOException
      • getFlushedBytes

        public long getFlushedBytes()
      • getMergedBytes

        public long getMergedBytes()