mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
indexes: single entry snapshot indexes should use corresponding diff builder
GitOrigin-RevId: ad332a51e3a3a5e9536784a518d5a5921682ef5d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b4459f6b88
commit
711b668a31
@@ -6,6 +6,7 @@ import com.intellij.util.indexing.impl.InputDataDiffBuilder;
|
||||
import com.intellij.util.indexing.impl.MapInputDataDiffBuilder;
|
||||
import com.intellij.util.indexing.impl.forward.AbstractMapForwardIndexAccessor;
|
||||
import com.intellij.util.indexing.impl.forward.IntForwardIndexAccessor;
|
||||
import com.intellij.util.indexing.impl.forward.SingleEntryIndexForwardIndexAccessor;
|
||||
import com.intellij.util.io.EnumeratorIntegerDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -17,10 +18,12 @@ public class HashIdForwardIndexAccessor<Key, Value, Input>
|
||||
extends AbstractMapForwardIndexAccessor<Key, Value, Integer>
|
||||
implements IntForwardIndexAccessor<Key, Value> {
|
||||
private final UpdatableSnapshotInputMappingIndex<Key, Value, Input> mySnapshotInputMappingIndex;
|
||||
private final boolean myIsSingleEntryIndex;
|
||||
|
||||
HashIdForwardIndexAccessor(@NotNull UpdatableSnapshotInputMappingIndex<Key, Value, Input> snapshotInputMappingIndex) {
|
||||
HashIdForwardIndexAccessor(@NotNull UpdatableSnapshotInputMappingIndex<Key, Value, Input> snapshotInputMappingIndex, boolean isSingleEntryIndex) {
|
||||
super(EnumeratorIntegerDescriptor.INSTANCE);
|
||||
mySnapshotInputMappingIndex = snapshotInputMappingIndex;
|
||||
myIsSingleEntryIndex = isSingleEntryIndex;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -32,7 +35,9 @@ public class HashIdForwardIndexAccessor<Key, Value, Input>
|
||||
@NotNull
|
||||
@Override
|
||||
public InputDataDiffBuilder<Key, Value> getDiffBuilderFromInt(int inputId, int hashId) throws IOException {
|
||||
return new MapInputDataDiffBuilder<>(inputId, convertToMap(hashId));
|
||||
return myIsSingleEntryIndex
|
||||
? new SingleEntryIndexForwardIndexAccessor.SingleValueDiffBuilder(inputId, convertToMap(hashId))
|
||||
: new MapInputDataDiffBuilder<>(inputId, convertToMap(hashId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SnapshotInputMappings<Key, Value> implements UpdatableSnapshotInput
|
||||
|
||||
myIndexer = indexExtension.getIndexer();
|
||||
myContents = createContentsIndex();
|
||||
myHashIdForwardIndexAccessor = new HashIdForwardIndexAccessor<>(this);
|
||||
myHashIdForwardIndexAccessor = new HashIdForwardIndexAccessor<>(this, storeOnlySingleValue);
|
||||
myIndexingTrace = DebugAssertions.EXTRA_SANITY_CHECKS ? createIndexingTrace() : null;
|
||||
|
||||
if (VfsAwareMapReduceIndex.isCompositeIndexer(myIndexer)) {
|
||||
|
||||
Reference in New Issue
Block a user