Package org.apache.lucene.store
Class LockValidatingDirectoryWrapper
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.store.FilterDirectory
org.apache.lucene.store.LockValidatingDirectoryWrapper
- All Implemented Interfaces:
Closeable,AutoCloseable
This class makes a best-effort check that a provided
Lock is valid before any destructive
filesystem operation.-
Field Summary
Fields inherited from class org.apache.lucene.store.FilterDirectory
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCopies an existingsrcfile from directoryfromto a non-existent filedestin this directory.createOutput(String name, IOContext context) Creates a new, empty file in the directory and returns anIndexOutputinstance for appending data to this file.voiddeleteFile(String name) Removes an existing file in the directory.voidRenamessourcefile todestfile wheredestmust not already exist in the directory.voidsync(Collection<String> names) Ensures that any writes to these files are moved to stable storage (made durable).voidEnsures that directory metadata, such as recent file renames, are moved to stable storage.Methods inherited from class org.apache.lucene.store.FilterDirectory
close, createTempOutput, ensureOpen, fileLength, getDelegate, getPendingDeletions, listAll, obtainLock, openInput, toString, unwrapMethods inherited from class org.apache.lucene.store.Directory
getTempFileName, openChecksumInput
-
Constructor Details
-
LockValidatingDirectoryWrapper
-
-
Method Details
-
deleteFile
Description copied from class:DirectoryRemoves an existing file in the directory.This method must throw either
NoSuchFileExceptionorFileNotFoundExceptionifnamepoints to a non-existing file.- Overrides:
deleteFilein classFilterDirectory- Parameters:
name- the name of an existing file.- Throws:
IOException- in case of I/O error
-
createOutput
Description copied from class:DirectoryCreates a new, empty file in the directory and returns anIndexOutputinstance for appending data to this file.This method must throw
FileAlreadyExistsExceptionif the file already exists.- Overrides:
createOutputin classFilterDirectory- Parameters:
name- the name of the file to create.- Throws:
IOException- in case of I/O error
-
copyFrom
Description copied from class:DirectoryCopies an existingsrcfile from directoryfromto a non-existent filedestin this directory. The given IOContext is only used for opening the destination file.- Overrides:
copyFromin classDirectory- Throws:
IOException
-
rename
Description copied from class:DirectoryRenamessourcefile todestfile wheredestmust not already exist in the directory.It is permitted for this operation to not be truly atomic, for example both
sourceanddestcan be visible temporarily inDirectory.listAll(). However, the implementation of this method must ensure the content ofdestappears as the entiresourceatomically. So oncedestis visible for readers, the entire content of previoussourceis visible.This method is used by IndexWriter to publish commits.
- Overrides:
renamein classFilterDirectory- Throws:
IOException
-
syncMetaData
Description copied from class:DirectoryEnsures that directory metadata, such as recent file renames, are moved to stable storage.- Overrides:
syncMetaDatain classFilterDirectory- Throws:
IOException- See Also:
-
sync
Description copied from class:DirectoryEnsures that any writes to these files are moved to stable storage (made durable).Lucene uses this to properly commit changes to the index, to prevent a machine/OS crash from corrupting the index.
- Overrides:
syncin classFilterDirectory- Throws:
IOException- See Also:
-