Search in sources :

Example 1 with IndexFiles

use of org.neo4j.kernel.impl.index.schema.IndexFiles in project neo4j by neo4j.

the class FusionIndexPopulatorTest method initiateMocks.

private void initiateMocks() {
    IndexSlot[] aliveSlots = fusionVersion.aliveSlots();
    populators = new EnumMap<>(IndexSlot.class);
    fill(populators, IndexPopulator.EMPTY);
    alivePopulators = new IndexPopulator[aliveSlots.length];
    for (int i = 0; i < aliveSlots.length; i++) {
        IndexPopulator mock = mock(IndexPopulator.class);
        alivePopulators[i] = mock;
        switch(aliveSlots[i]) {
            case GENERIC:
                populators.put(GENERIC, mock);
                break;
            case LUCENE:
                populators.put(LUCENE, mock);
                break;
            default:
                throw new RuntimeException();
        }
    }
    SlotSelector slotSelector = fusionVersion.slotSelector();
    InstanceSelector<IndexPopulator> instanceSelector = new InstanceSelector<>(populators);
    fs = mock(FileSystemAbstraction.class);
    directoryStructure = directoriesByProvider(Path.of("storeDir")).forProvider(UNDECIDED);
    when(fs.fileExists(directoryStructure.directoryForIndex(indexId))).thenReturn(true);
    IndexFiles indexFiles = new IndexFiles.Directory(fs, directoryStructure, indexId);
    fusionIndexPopulator = new FusionIndexPopulator(slotSelector, instanceSelector, indexFiles, false);
}
Also used : FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) IndexFiles(org.neo4j.kernel.impl.index.schema.IndexFiles) IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator)

Example 2 with IndexFiles

use of org.neo4j.kernel.impl.index.schema.IndexFiles in project neo4j by neo4j.

the class FusionIndexAccessorTest method initiateMocks.

private void initiateMocks() {
    IndexSlot[] activeSlots = fusionVersion.aliveSlots();
    accessors = new EnumMap<>(IndexSlot.class);
    fill(accessors, IndexAccessor.EMPTY);
    aliveAccessors = new IndexAccessor[activeSlots.length];
    for (int i = 0; i < activeSlots.length; i++) {
        IndexAccessor mock = mock(IndexAccessor.class);
        aliveAccessors[i] = mock;
        switch(activeSlots[i]) {
            case GENERIC:
                accessors.put(GENERIC, mock);
                break;
            case LUCENE:
                accessors.put(LUCENE, mock);
                break;
            default:
                throw new RuntimeException();
        }
    }
    SlotSelector slotSelector = fusionVersion.slotSelector();
    InstanceSelector<IndexAccessor> instanceSelector = new InstanceSelector<>(accessors);
    fs = mock(FileSystemAbstraction.class);
    directoryStructure = directoriesByProvider(Path.of("storeDir")).forProvider(UNDECIDED);
    IndexFiles indexFiles = new IndexFiles.Directory(fs, directoryStructure, indexDescriptor.getId());
    fusionIndexAccessor = new FusionIndexAccessor(slotSelector, instanceSelector, indexDescriptor, indexFiles);
}
Also used : FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) IndexAccessor(org.neo4j.kernel.api.index.IndexAccessor) IndexFiles(org.neo4j.kernel.impl.index.schema.IndexFiles)

Example 3 with IndexFiles

use of org.neo4j.kernel.impl.index.schema.IndexFiles in project neo4j by neo4j.

the class FusionIndexProvider method getPopulator.

@Override
public IndexPopulator getPopulator(IndexDescriptor descriptor, IndexSamplingConfig samplingConfig, ByteBufferFactory bufferFactory, MemoryTracker memoryTracker, TokenNameLookup tokenNameLookup) {
    EnumMap<IndexSlot, IndexPopulator> populators = providers.map(provider -> provider.getPopulator(descriptor, samplingConfig, bufferFactory, memoryTracker, tokenNameLookup));
    IndexFiles indexFiles = indexFiles(descriptor);
    return new FusionIndexPopulator(slotSelector, new InstanceSelector<>(populators), indexFiles, archiveFailedIndex);
}
Also used : IndexFiles(org.neo4j.kernel.impl.index.schema.IndexFiles) IndexPopulator(org.neo4j.kernel.api.index.IndexPopulator)

Example 4 with IndexFiles

use of org.neo4j.kernel.impl.index.schema.IndexFiles in project neo4j by neo4j.

the class FusionIndexProvider method getOnlineAccessor.

@Override
public IndexAccessor getOnlineAccessor(IndexDescriptor descriptor, IndexSamplingConfig samplingConfig, TokenNameLookup tokenNameLookup) throws IOException {
    EnumMap<IndexSlot, IndexAccessor> accessors = providers.map(provider -> provider.getOnlineAccessor(descriptor, samplingConfig, tokenNameLookup));
    IndexFiles indexFiles = indexFiles(descriptor);
    return new FusionIndexAccessor(slotSelector, new InstanceSelector<>(accessors), descriptor, indexFiles);
}
Also used : IndexFiles(org.neo4j.kernel.impl.index.schema.IndexFiles) IndexAccessor(org.neo4j.kernel.api.index.IndexAccessor) MinimalIndexAccessor(org.neo4j.kernel.api.index.MinimalIndexAccessor) NativeMinimalIndexAccessor(org.neo4j.kernel.impl.index.schema.NativeMinimalIndexAccessor)

Aggregations

IndexFiles (org.neo4j.kernel.impl.index.schema.IndexFiles)4 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)2 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)2 IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)2 MinimalIndexAccessor (org.neo4j.kernel.api.index.MinimalIndexAccessor)1 NativeMinimalIndexAccessor (org.neo4j.kernel.impl.index.schema.NativeMinimalIndexAccessor)1