public class DirectIOLinuxDirectory
extends org.apache.lucene.store.FSDirectory
Directory
implementation that uses the
Linux-specific O_DIRECT flag to bypass all OS level
caching. To use this you must compile
NativePosixUtil.cpp (exposes Linux-specific APIs through
JNI) for your platform.
WARNING: this code is very new and quite easily could contain horrible bugs. For example, here's one known issue: if you use seek in IndexOutput, and then write more than one buffer's worth of bytes, then the file will be wrong. Lucene does not do this (only writes small number of bytes after seek).
Constructor and Description |
---|
DirectIOLinuxDirectory(File path,
org.apache.lucene.store.LockFactory lockFactory,
int forcedBufferSize)
Create a new NIOFSDirectory for the named location.
|
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.store.IndexOutput |
createOutput(String name) |
org.apache.lucene.store.IndexInput |
openInput(String name,
int bufferSize) |
close, deleteFile, ensureCanWrite, fileExists, fileLength, fileModified, fileModified, fsync, getDirectory, getFile, getLockID, getReadChunkSize, listAll, listAll, onIndexOutputClosed, open, open, openInput, setLockFactory, setReadChunkSize, sync, sync, toString, touchFile
public DirectIOLinuxDirectory(File path, org.apache.lucene.store.LockFactory lockFactory, int forcedBufferSize) throws IOException
path
- the path of the directorylockFactory
- the lock factory to use, or null for the default
(NativeFSLockFactory
);forcedBufferSize
- if this is 0, just use Lucene's
default buffer size; else, force this buffer size.
For best performance, force the buffer size to
something fairly large (eg 1 MB), but note that this
will eat up the JRE's direct buffer storage spaceIOException
public org.apache.lucene.store.IndexInput openInput(String name, int bufferSize) throws IOException
openInput
in class org.apache.lucene.store.Directory
IOException
public org.apache.lucene.store.IndexOutput createOutput(String name) throws IOException
createOutput
in class org.apache.lucene.store.FSDirectory
IOException