public final class LockValidatingDirectoryWrapper extends FilterDirectory
Lock
is valid before any destructive filesystem operation.in| Constructor and Description |
|---|
LockValidatingDirectoryWrapper(Directory in,
Lock writeLock) |
| Modifier and Type | Method and Description |
|---|---|
void |
copyFrom(Directory from,
java.lang.String src,
java.lang.String dest,
IOContext context)
Copies an existing
src file from directory from
to a non-existent file dest in this directory. |
IndexOutput |
createOutput(java.lang.String name,
IOContext context)
Creates a new, empty file in the directory and returns an
IndexOutput
instance for appending data to this file. |
void |
deleteFile(java.lang.String name)
Removes an existing file in the directory.
|
void |
rename(java.lang.String source,
java.lang.String dest)
Renames
source file to dest file where
dest must not already exist in the directory. |
void |
sync(java.util.Collection<java.lang.String> names)
Ensures that any writes to these files are moved to
stable storage (made durable).
|
void |
syncMetaData()
Ensures that directory metadata, such as recent file renames, are moved to stable
storage.
|
close, createTempOutput, fileLength, getDelegate, getPendingDeletions, listAll, obtainLock, openInput, toString, unwrapensureOpen, openChecksumInputpublic void deleteFile(java.lang.String name)
throws java.io.IOException
DirectoryNoSuchFileException or FileNotFoundException
if name points to a non-existing file.deleteFile in class FilterDirectoryname - the name of an existing file.java.io.IOException - in case of I/O errorpublic IndexOutput createOutput(java.lang.String name, IOContext context) throws java.io.IOException
DirectoryIndexOutput
instance for appending data to this file.
This method must throw FileAlreadyExistsException if the file
already exists.createOutput in class FilterDirectoryname - the name of the file to create.java.io.IOException - in case of I/O errorpublic void copyFrom(Directory from, java.lang.String src, java.lang.String dest, IOContext context) throws java.io.IOException
Directorysrc file from directory from
to a non-existent file dest in this directory.public void rename(java.lang.String source,
java.lang.String dest)
throws java.io.IOException
Directorysource 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.rename in class FilterDirectoryjava.io.IOExceptionpublic void syncMetaData()
throws java.io.IOException
DirectorysyncMetaData in class FilterDirectoryjava.io.IOExceptionDirectory.sync(Collection)public void sync(java.util.Collection<java.lang.String> names)
throws java.io.IOException
Directorysync in class FilterDirectoryjava.io.IOExceptionDirectory.syncMetaData()Copyright © 2000–2025 The Apache Software Foundation. All rights reserved.