Module org.apache.lucene.misc
Package org.apache.lucene.misc.store
Class ByteWritesTrackingDirectoryWrapper
- java.lang.Object
-
- org.apache.lucene.store.Directory
-
- org.apache.lucene.store.FilterDirectory
-
- org.apache.lucene.misc.store.ByteWritesTrackingDirectoryWrapper
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class ByteWritesTrackingDirectoryWrapper extends FilterDirectory
FilterDirectory
that tracks write amplification factor
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicLong
flushedBytes
private java.util.concurrent.atomic.AtomicLong
mergedBytes
boolean
trackTempOutput
-
Fields inherited from class org.apache.lucene.store.FilterDirectory
in
-
-
Constructor Summary
Constructors Constructor Description ByteWritesTrackingDirectoryWrapper(Directory in)
ByteWritesTrackingDirectoryWrapper(Directory in, boolean trackTempOutput)
Constructor with option to track tempOutput
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private IndexOutput
createByteTrackingOutput(IndexOutput output, IOContext.Context context)
IndexOutput
createOutput(java.lang.String name, IOContext ioContext)
Creates a new, empty file in the directory and returns anIndexOutput
instance for appending data to this file.IndexOutput
createTempOutput(java.lang.String prefix, java.lang.String suffix, IOContext ioContext)
Creates a new, empty, temporary file in the directory and returns anIndexOutput
instance for appending data to this file.long
getFlushedBytes()
long
getMergedBytes()
-
Methods inherited from class org.apache.lucene.store.FilterDirectory
close, deleteFile, ensureOpen, fileLength, getDelegate, getPendingDeletions, listAll, obtainLock, openInput, rename, sync, syncMetaData, toString, unwrap
-
Methods inherited from class org.apache.lucene.store.Directory
copyFrom, getTempFileName, openChecksumInput
-
-
-
-
Constructor Detail
-
ByteWritesTrackingDirectoryWrapper
public ByteWritesTrackingDirectoryWrapper(Directory in)
-
ByteWritesTrackingDirectoryWrapper
public ByteWritesTrackingDirectoryWrapper(Directory in, boolean trackTempOutput)
Constructor with option to track tempOutput- Parameters:
in
- input DirectorytrackTempOutput
- 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 anIndexOutput
instance for appending data to this file.This method must throw
FileAlreadyExistsException
if the file already exists.- Overrides:
createOutput
in classFilterDirectory
- 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 anIndexOutput
instance for appending data to this file.The temporary file name (accessible via
IndexOutput.getName()
) will start withprefix
, end withsuffix
and have a reserved file extension.tmp
.- Overrides:
createTempOutput
in classFilterDirectory
- Throws:
java.io.IOException
-
createByteTrackingOutput
private IndexOutput createByteTrackingOutput(IndexOutput output, IOContext.Context context)
-
getFlushedBytes
public long getFlushedBytes()
-
getMergedBytes
public long getMergedBytes()
-
-