mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
MapReduceIndex moved to [util]
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user