CavalliumDBEngine/src/main/java/it/cavallium/dbengine/lucene/AlwaysDirectIOFSDirectory.java

25 lines
737 B
Java
Raw Normal View History

2021-07-01 21:19:52 +02:00
package it.cavallium.dbengine.lucene;
import java.io.IOException;
import java.nio.file.Path;
import java.util.OptionalLong;
import org.apache.lucene.misc.store.DirectIODirectory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.IOContext;
public class AlwaysDirectIOFSDirectory extends DirectIODirectory {
2023-02-22 16:59:35 +01:00
public AlwaysDirectIOFSDirectory(Path path, int mergeBufferSize, long minBytesDirect) throws IOException {
2021-07-01 21:19:52 +02:00
super(FSDirectory.open(path), mergeBufferSize, minBytesDirect);
}
2023-02-22 16:59:35 +01:00
public AlwaysDirectIOFSDirectory(Path path) throws IOException {
2021-07-01 21:19:52 +02:00
super(FSDirectory.open(path));
}
@Override
protected boolean useDirectIO(String name, IOContext context, OptionalLong fileLength) {
return true;
}
}