Package org.apache.lucene.store

# Class TrackingDirectoryWrapper

java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.store.FilterDirectory
org.apache.lucene.store.TrackingDirectoryWrapper

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public final class TrackingDirectoryWrapper extends FilterDirectory
A delegating Directory that records which files were written to and deleted.

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.store.FilterDirectory

  `in`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TrackingDirectoryWrapper(Directory in)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearCreatedFiles()`
  `void`
  `copyFrom(Directory from, String src, String dest, IOContext context)`
  Copies an existing `src` file from directory `from` to a non-existent file `dest` in this directory.
  `IndexOutput`
  `createOutput(String name, IOContext context)`
  Creates a new, empty file in the directory and returns an `IndexOutput` instance for appending data to this file.
  `IndexOutput`
  `createTempOutput(String prefix, String suffix, IOContext context)`
  Creates a new, empty, temporary file in the directory and returns an `IndexOutput` instance for appending data to this file.
  `void`
  `deleteFile(String name)`
  Removes an existing file in the directory.
  `Set<String>`
  `getCreatedFiles()`
  NOTE: returns a copy of the created files.
  `void`
  `rename(String source, String dest)`
  Renames `source` file to `dest` file where `dest` must not already exist in the directory.

  ### Methods inherited from class org.apache.lucene.store.FilterDirectory

  `close, ensureOpen, fileLength, getDelegate, getPendingDeletions, listAll, obtainLock, openInput, sync, syncMetaData, toString, unwrap`

  ### Methods inherited from class org.apache.lucene.store.Directory

  `getTempFileName, openChecksumInput`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### TrackingDirectoryWrapper

    public TrackingDirectoryWrapper(Directory in)

- ## Method Details

  - ### deleteFile

    public void deleteFile(String name) throws IOException
    Description copied from class: `Directory`
    Removes an existing file in the directory.

    This method must throw either `NoSuchFileException` or `FileNotFoundException` if `name` points to a non-existing file.

    Overrides:
      `deleteFile` in class `FilterDirectory`
    Parameters:
      `name` - the name of an existing file.
    Throws:
      `IOException` - in case of I/O error

  - ### createOutput

    public IndexOutput createOutput(String name, IOContext context) throws 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:
      `IOException` - in case of I/O error

  - ### createTempOutput

    public IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws 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:
      `IOException`

  - ### copyFrom

    public void copyFrom(Directory from, String src, String dest, IOContext context) throws IOException
    Description copied from class: `Directory`
    Copies an existing `src` file from directory `from` to a non-existent file `dest` in this directory. The given IOContext is only used for opening the destination file.
    Overrides:
      `copyFrom` in class `Directory`
    Throws:
      `IOException`

  - ### rename

    public void rename(String source, String dest) throws IOException
    Description copied from class: `Directory`
    Renames `source` file to `dest` file where `dest` must not already exist in the directory.

    It is permitted for this operation to not be truly atomic, for example both `source` and `dest` can be visible temporarily in `Directory.listAll()`. However, the implementation of this method must ensure the content of `dest` appears as the entire `source` atomically. So once `dest` is visible for readers, the entire content of previous `source` is visible.

    This method is used by IndexWriter to publish commits.

    Overrides:
      `rename` in class `FilterDirectory`
    Throws:
      `IOException`

  - ### getCreatedFiles

    public Set<String> getCreatedFiles()
    NOTE: returns a copy of the created files.

  - ### clearCreatedFiles

    public void clearCreatedFiles()