use nio api for indexes

GitOrigin-RevId: 1f0d62415abf79032d40ab6da725dafd4cf210ac
This commit is contained in:
Dmitry Batkovich
2019-12-19 06:33:37 +00:00
committed by intellij-monorepo-bot
parent 5632e066b2
commit b2fe378c9f
78 changed files with 511 additions and 568 deletions
@@ -103,7 +103,7 @@ public class StringIndex {
};
myIndex = new MapReduceIndex<String, String, PathContentPair>(extension,
storage,
new PersistentMapBasedForwardIndex(forwardIndexFile, false),
new PersistentMapBasedForwardIndex(forwardIndexFile.toPath(), false),
new KeyCollectionForwardIndexAccessor<>(anotherStringExternalizer)) {
@Override
public void checkCanceled() {
@@ -13,6 +13,7 @@ import com.intellij.util.io.PersistentStringEnumerator;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
public class StubReSerializationTest extends JavaCodeInsightFixtureTestCase {
@@ -20,8 +21,8 @@ public class StubReSerializationTest extends JavaCodeInsightFixtureTestCase {
SerializationManagerEx serializationManager = SerializationManagerEx.getInstanceEx();
serializationManager.flushNameStorage();
File externalStubEnumerator =
VfsUtilCore.virtualToIoFile(myFixture.getTempDirFixture().createFile("external_stub_serializer_enumerator/serializer.names"));
Path externalStubEnumerator =
VfsUtilCore.virtualToIoFile(myFixture.getTempDirFixture().createFile("external_stub_serializer_enumerator/serializer.names")).toPath();
// ensure we have different serializer's enumeration
try (PersistentStringEnumerator enumerator = new PersistentStringEnumerator(externalStubEnumerator)) {
@@ -169,7 +169,7 @@ class IndexTest extends JavaCodeInsightFixtureTestCase {
private static StringIndex createIndex(String testName, EnumeratorStringDescriptor keyDescriptor, boolean readOnly) {
final File storageFile = FileUtil.createTempFile("index_test", "storage")
final File metaIndexFile = FileUtil.createTempFile("index_test_inputs", "storage")
final VfsAwareMapIndexStorage indexStorage = new VfsAwareMapIndexStorage(storageFile, keyDescriptor, new EnumeratorStringDescriptor(),
final VfsAwareMapIndexStorage indexStorage = new VfsAwareMapIndexStorage(storageFile.toPath(), keyDescriptor, new EnumeratorStringDescriptor(),
16 * 1024, readOnly)
return new StringIndex(testName, indexStorage, metaIndexFile, !readOnly)
}