Package org.apache.lucene.misc.store
Class HardlinkCopyDirectoryWrapper
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.store.FilterDirectory
org.apache.lucene.misc.store.HardlinkCopyDirectoryWrapper
- All Implemented Interfaces:
Closeable
,AutoCloseable
This directory wrapper overrides
Directory.copyFrom(Directory, String, String, IOContext)
in order to optionally use a hard-link instead of a full byte by byte file copy if applicable.
Hard-links are only used if the underlying filesystem supports it and if the LinkPermission
"hard" is granted.
NOTE: Using hard-links changes the copy semantics of Directory.copyFrom(Directory, String, String, IOContext)
. When hard-links are used changes to
the source file will be reflected in the target file and vice-versa. Within Lucene, files are
write once and should not be modified after they have been written. This directory should not be
used in situations where files change after they have been written.
-
Field Summary
Fields inherited from class org.apache.lucene.store.FilterDirectory
in
-
Constructor Summary
ConstructorDescriptionCreates a new HardlinkCopyDirectoryWrapper delegating to the given directory -
Method Summary
Methods inherited from class org.apache.lucene.store.FilterDirectory
close, createOutput, createTempOutput, deleteFile, ensureOpen, fileLength, getDelegate, getPendingDeletions, listAll, obtainLock, openInput, rename, sync, syncMetaData, toString, unwrap
Methods inherited from class org.apache.lucene.store.Directory
getTempFileName, openChecksumInput
-
Constructor Details
-
HardlinkCopyDirectoryWrapper
Creates a new HardlinkCopyDirectoryWrapper delegating to the given directory
-
-
Method Details
-
copyFrom
public void copyFrom(Directory from, String srcFile, String destFile, IOContext context) throws IOException - Overrides:
copyFrom
in classDirectory
- Throws:
IOException
-