Package org.apache.lucene.codecs
Class CompoundDirectory
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.codecs.CompoundDirectory
- All Implemented Interfaces:
Closeable,AutoCloseable
A read-only
Directory that consists of a view over a compound file.- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidChecks consistency of this directory.final IndexOutputcreateOutput(String name, IOContext context) Creates a new, empty file in the directory and returns anIndexOutputinstance for appending data to this file.final IndexOutputcreateTempOutput(String prefix, String suffix, IOContext context) Creates a new, empty, temporary file in the directory and returns anIndexOutputinstance for appending data to this file.final voiddeleteFile(String name) Not implementedfinal LockobtainLock(String name) Acquires and returns aLockfor a file with the given name.final voidNot implementedfinal voidsync(Collection<String> names) Ensures that any writes to these files are moved to stable storage (made durable).final voidEnsures that directory metadata, such as recent file renames, are moved to stable storage.Methods inherited from class org.apache.lucene.store.Directory
close, copyFrom, ensureOpen, fileLength, getPendingDeletions, getTempFileName, listAll, openChecksumInput, openInput, toString
-
Constructor Details
-
CompoundDirectory
protected CompoundDirectory()Sole constructor.
-
-
Method Details
-
checkIntegrity
Checks consistency of this directory.Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value against large data files.
- Throws:
IOException
-
deleteFile
Not implemented- Specified by:
deleteFilein classDirectory- Parameters:
name- the name of an existing file.- Throws:
UnsupportedOperationException- always: not supported by CFS
-
rename
Not implemented- Specified by:
renamein classDirectory- Throws:
UnsupportedOperationException- always: not supported by CFS
-
syncMetaData
public final void syncMetaData()Description copied from class:DirectoryEnsures that directory metadata, such as recent file renames, are moved to stable storage.- Specified by:
syncMetaDatain classDirectory- See Also:
-
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.- Specified by:
createOutputin classDirectory- Parameters:
name- the name of the file to create.- Throws:
IOException- in case of I/O error
-
createTempOutput
public final IndexOutput createTempOutput(String prefix, String suffix, IOContext context) throws IOException Description copied from class:DirectoryCreates a new, empty, temporary file in the directory and returns anIndexOutputinstance for appending data to this file.The temporary file name (accessible via
IndexOutput.getName()) will start withprefix, end withsuffixand have a reserved file extension.tmp.- Specified by:
createTempOutputin classDirectory- Throws:
IOException
-
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.
-
obtainLock
Description copied from class:DirectoryAcquires and returns aLockfor a file with the given name.- Specified by:
obtainLockin classDirectory- Parameters:
name- the name of the lock file
-