Search in sources :

Example 1 with PropertyPhysicalToLogicalConverter

use of org.neo4j.kernel.impl.api.index.PropertyPhysicalToLogicalConverter in project neo4j by neo4j.

the class IndexBatchTransactionApplierTest method shouldProvideLabelScanStoreUpdatesSortedByNodeId.

@Test
public void shouldProvideLabelScanStoreUpdatesSortedByNodeId() throws Exception {
    // GIVEN
    IndexingService indexing = mock(IndexingService.class);
    LabelScanWriter writer = new OrderVerifyingLabelScanWriter(10, 15, 20);
    WorkSync<Supplier<LabelScanWriter>, LabelUpdateWork> labelScanSync = spy(new WorkSync<>(singletonProvider(writer)));
    WorkSync<IndexingService, IndexUpdatesWork> indexUpdatesSync = new WorkSync<>(indexing);
    TransactionToApply tx = mock(TransactionToApply.class);
    PropertyStore propertyStore = mock(PropertyStore.class);
    try (IndexBatchTransactionApplier applier = new IndexBatchTransactionApplier(indexing, labelScanSync, indexUpdatesSync, mock(NodeStore.class), mock(PropertyLoader.class), new PropertyPhysicalToLogicalConverter(propertyStore), TransactionApplicationMode.INTERNAL)) {
        try (TransactionApplier txApplier = applier.startTx(tx)) {
            // WHEN
            txApplier.visitNodeCommand(node(15));
            txApplier.visitNodeCommand(node(20));
            txApplier.visitNodeCommand(node(10));
        }
    }
    // THEN all assertions happen inside the LabelScanWriter#write and #close
    verify(labelScanSync).apply(any());
}
Also used : TransactionToApply(org.neo4j.kernel.impl.api.TransactionToApply) WorkSync(org.neo4j.concurrent.WorkSync) PropertyPhysicalToLogicalConverter(org.neo4j.kernel.impl.api.index.PropertyPhysicalToLogicalConverter) TransactionApplier(org.neo4j.kernel.impl.api.TransactionApplier) PropertyLoader(org.neo4j.kernel.impl.transaction.state.PropertyLoader) NodeStore(org.neo4j.kernel.impl.store.NodeStore) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) Supplier(java.util.function.Supplier) LabelScanWriter(org.neo4j.kernel.api.labelscan.LabelScanWriter) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore) Test(org.junit.Test)

Example 2 with PropertyPhysicalToLogicalConverter

use of org.neo4j.kernel.impl.api.index.PropertyPhysicalToLogicalConverter in project neo4j by neo4j.

the class TransactionRecordStateTest method indexUpdatesOf.

private Iterable<NodeUpdates> indexUpdatesOf(NeoStores neoStores, TransactionRepresentation transaction) throws IOException {
    NodePropertyCommandsExtractor extractor = new NodePropertyCommandsExtractor();
    transaction.accept(extractor);
    OnlineIndexUpdates lazyIndexUpdates = new OnlineIndexUpdates(neoStores.getNodeStore(), new PropertyLoader(neoStores), new PropertyPhysicalToLogicalConverter(neoStores.getPropertyStore()));
    lazyIndexUpdates.feed(extractor.propertyCommandsByNodeIds(), extractor.nodeCommandsById());
    return lazyIndexUpdates;
}
Also used : PropertyPhysicalToLogicalConverter(org.neo4j.kernel.impl.api.index.PropertyPhysicalToLogicalConverter) NodePropertyCommandsExtractor(org.neo4j.kernel.impl.api.index.NodePropertyCommandsExtractor)

Aggregations

PropertyPhysicalToLogicalConverter (org.neo4j.kernel.impl.api.index.PropertyPhysicalToLogicalConverter)2 Supplier (java.util.function.Supplier)1 Test (org.junit.Test)1 WorkSync (org.neo4j.concurrent.WorkSync)1 LabelScanWriter (org.neo4j.kernel.api.labelscan.LabelScanWriter)1 TransactionApplier (org.neo4j.kernel.impl.api.TransactionApplier)1 TransactionToApply (org.neo4j.kernel.impl.api.TransactionToApply)1 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)1 NodePropertyCommandsExtractor (org.neo4j.kernel.impl.api.index.NodePropertyCommandsExtractor)1 NodeStore (org.neo4j.kernel.impl.store.NodeStore)1 PropertyStore (org.neo4j.kernel.impl.store.PropertyStore)1 PropertyLoader (org.neo4j.kernel.impl.transaction.state.PropertyLoader)1