MapReduceIndex moved to [util]

This commit is contained in:
Dmitry Batkovich
2016-12-02 19:31:45 +03:00
parent 4dd273cb8f
commit 3e927e977f
49 changed files with 2444 additions and 1691 deletions
@@ -154,7 +154,7 @@ class IndexTest extends JavaCodeInsightFixtureTestCase {
final File storageFile = FileUtil.createTempFile("index_test", "storage")
final File metaIndexFile = FileUtil.createTempFile("index_test_inputs", "storage")
PersistentHashMap<Integer, Collection<String>> index = createMetaIndex(metaIndexFile)
final MapIndexStorage indexStorage = new MapIndexStorage(storageFile, keyDescriptor, new EnumeratorStringDescriptor(), 16 * 1024)
final VfsAwareMapIndexStorage indexStorage = new VfsAwareMapIndexStorage(storageFile, keyDescriptor, new EnumeratorStringDescriptor(), 16 * 1024)
return new StringIndex(testName, indexStorage, index)
}
@@ -17,12 +17,16 @@ package com.intellij.index;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.*;
import com.intellij.util.indexing.impl.IndexStorage;
import com.intellij.util.indexing.impl.MapBasedForwardIndex;
import com.intellij.util.indexing.impl.MapReduceIndex;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.EnumeratorStringDescriptor;
import com.intellij.util.io.KeyDescriptor;
import com.intellij.util.io.PersistentHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import java.io.IOException;
import java.util.Collection;
@@ -39,11 +43,12 @@ public class StringIndex {
public StringIndex(String testName, final IndexStorage<String, String> storage, final PersistentHashMap<Integer, Collection<String>> inputIndex)
throws IOException {
myIndex = new MapReduceIndex<String, String, PathContentPair>(new IndexExtension<String, String, PathContentPair>() {
ID<String, String> id = ID.create(testName + "string_index");
IndexExtension<String, String, PathContentPair> extension = new IndexExtension<String, String, PathContentPair>() {
@NotNull
@Override
public ID<String, String> getName() {
return new ID<String, String>(testName + "string_index") {};
return id;
}
@NotNull
@@ -68,10 +73,19 @@ public class StringIndex {
public int getVersion() {
return 0;
}
}, storage) {
protected PersistentHashMap<Integer, Collection<String>> createInputsIndex() throws IOException {
};
myIndex = new VfsAwareMapReduceIndex<String, String, PathContentPair>(extension, storage, new MapBasedForwardIndex<String, String>(extension) {
@NotNull
@Override
public PersistentHashMap<Integer, Collection<String>> createMap() throws IOException {
return inputIndex;
}
}) {
@Override
public void requestRebuild(@NotNull Exception ex) {
Assert.fail();
}
};
}