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);
}
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);
}
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);
}
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);
}
Aggregations