Search in sources :

Example 1 with MapReduceIndex

use of com.intellij.util.indexing.impl.MapReduceIndex in project intellij-community by JetBrains.

the class FileBasedIndexImpl method cleanupForNextTest.

@TestOnly
public void cleanupForNextTest() {
    myChangedFilesCollector.ensureUpToDate();
    myTransactionMap = SmartFMap.emptyMap();
    IndexConfiguration state = getState();
    for (ID<?, ?> indexId : state.getIndexIDs()) {
        final MapReduceIndex index = (MapReduceIndex) state.getIndex(indexId);
        assert index != null;
        final MemoryIndexStorage memStorage = (MemoryIndexStorage) index.getStorage();
        index.getWriteLock().lock();
        try {
            memStorage.clearCaches();
        } finally {
            index.getWriteLock().unlock();
        }
    }
}
Also used : MapReduceIndex(com.intellij.util.indexing.impl.MapReduceIndex) TestOnly(org.jetbrains.annotations.TestOnly)

Example 2 with MapReduceIndex

use of com.intellij.util.indexing.impl.MapReduceIndex in project intellij-community by JetBrains.

the class FileBasedIndexImpl method setDataBufferingEnabled.

@NotNull
private StorageGuard.StorageModeExitHandler setDataBufferingEnabled(final boolean enabled) {
    StorageGuard.StorageModeExitHandler storageModeExitHandler = myStorageLock.enter(enabled);
    if (myPreviousDataBufferingState != enabled) {
        synchronized (myBufferingStateUpdateLock) {
            if (myPreviousDataBufferingState != enabled) {
                IndexConfiguration state = getState();
                for (ID<?, ?> indexId : state.getIndexIDs()) {
                    final MapReduceIndex index = (MapReduceIndex) state.getIndex(indexId);
                    assert index != null;
                    ((MemoryIndexStorage) index.getStorage()).setBufferingEnabled(enabled);
                }
                myPreviousDataBufferingState = enabled;
            }
        }
    }
    return storageModeExitHandler;
}
Also used : MapReduceIndex(com.intellij.util.indexing.impl.MapReduceIndex) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with MapReduceIndex

use of com.intellij.util.indexing.impl.MapReduceIndex in project intellij-community by JetBrains.

the class FileBasedIndexImpl method cleanupMemoryStorage.

private void cleanupMemoryStorage() {
    myLastIndexedDocStamps.clear();
    waitUntilIndicesAreInitialized();
    IndexConfiguration state = getState();
    for (ID<?, ?> indexId : state.getIndexIDs()) {
        final MapReduceIndex index = (MapReduceIndex) state.getIndex(indexId);
        assert index != null;
        final MemoryIndexStorage memStorage = (MemoryIndexStorage) index.getStorage();
        index.getWriteLock().lock();
        try {
            memStorage.clearMemoryMap();
        } finally {
            index.getWriteLock().unlock();
        }
        memStorage.fireMemoryStorageCleared();
    }
}
Also used : MapReduceIndex(com.intellij.util.indexing.impl.MapReduceIndex)

Aggregations

MapReduceIndex (com.intellij.util.indexing.impl.MapReduceIndex)3 NotNull (org.jetbrains.annotations.NotNull)1 TestOnly (org.jetbrains.annotations.TestOnly)1