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
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Copies an existingsrc
file from directoryfrom
to a non-existent filedest
in this directory.createOutput
(String name, IOContext context) Creates a new, empty file in the directory and returns anIndexOutput
instance for appending data to this file.createTempOutput
(String prefix, String suffix, IOContext context) Creates a new, empty, temporary file in the directory and returns anIndexOutput
instance for appending data to this file.void
deleteFile
(String name) Removes an existing file in the directory.NOTE: returns a copy of the created files.void
Renamessource
file todest
file wheredest
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
-
Constructor Details
-
TrackingDirectoryWrapper
-
-
Method Details
-
deleteFile
Description copied from class:Directory
Removes an existing file in the directory.This method must throw either
NoSuchFileException
orFileNotFoundException
ifname
points to a non-existing file.- Overrides:
deleteFile
in classFilterDirectory
- Parameters:
name
- the name of an existing file.- Throws:
IOException
- in case of I/O error
-
createOutput
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:
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 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:
IOException
-
copyFrom
Description copied from class:Directory
Copies an existingsrc
file from directoryfrom
to a non-existent filedest
in this directory.- Overrides:
copyFrom
in classDirectory
- Throws:
IOException
-
rename
Description copied from class:Directory
Renamessource
file todest
file wheredest
must not already exist in the directory.It is permitted for this operation to not be truly atomic, for example both
source
anddest
can be visible temporarily inDirectory.listAll()
. However, the implementation of this method must ensure the content ofdest
appears as the entiresource
atomically. So oncedest
is visible for readers, the entire content of previoussource
is visible.This method is used by IndexWriter to publish commits.
- Overrides:
rename
in classFilterDirectory
- Throws:
IOException
-
getCreatedFiles
NOTE: returns a copy of the created files. -
clearCreatedFiles
public void clearCreatedFiles()
-