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,
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. |
void |
deleteFile(String name)
Removes an existing file in the directory.
|
void |
rename(String source,
String dest)
Renames
source file to dest file where
dest must not already exist in the directory. |
void |
sync(Collection<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, getTempFileName, openChecksumInputpublic void deleteFile(String name) throws IOException
DirectoryNoSuchFileException or FileNotFoundException
if name points to a non-existing file.deleteFile in class FilterDirectoryname - the name of an existing file.IOException - in case of I/O errorpublic IndexOutput createOutput(String name, IOContext context) throws 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.IOException - in case of I/O errorpublic void copyFrom(Directory from, String src, String dest, IOContext context) throws IOException
Directorysrc file from directory from
to a non-existent file dest in this directory.copyFrom in class DirectoryIOExceptionpublic void rename(String source, String dest) throws 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 FilterDirectoryIOExceptionpublic void syncMetaData()
throws IOException
DirectorysyncMetaData in class FilterDirectoryIOExceptionDirectory.sync(Collection)public void sync(Collection<String> names) throws IOException
Directorysync in class FilterDirectoryIOExceptionDirectory.syncMetaData()Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.