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, unwrap
ensureOpen, openChecksumInput
public void deleteFile(String name) throws IOException
Directory
NoSuchFileException
or FileNotFoundException
if name
points to a non-existing file.deleteFile
in class FilterDirectory
name
- the name of an existing file.IOException
- in case of I/O errorpublic IndexOutput createOutput(String name, IOContext context) throws IOException
Directory
IndexOutput
instance for appending data to this file.
This method must throw FileAlreadyExistsException
if the file
already exists.createOutput
in class FilterDirectory
name
- 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
Directory
src
file from directory from
to a non-existent file dest
in this directory.copyFrom
in class Directory
IOException
public void rename(String source, String dest) throws IOException
Directory
source
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 FilterDirectory
IOException
public void syncMetaData() throws IOException
Directory
syncMetaData
in class FilterDirectory
IOException
Directory.sync(Collection)
public void sync(Collection<String> names) throws IOException
Directory
sync
in class FilterDirectory
IOException
Directory.syncMetaData()
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.