Search in sources :

Example 11 with Visitor

use of org.neo4j.helpers.collection.Visitor in project neo4j by neo4j.

the class BatchingMultipleIndexPopulatorTest method newStoreView.

@SuppressWarnings("unchecked")
private static IndexStoreView newStoreView(NodeUpdates... updates) {
    IndexStoreView storeView = mock(IndexStoreView.class);
    when(storeView.visitNodes(any(), any(), any(), any(), anyBoolean())).thenAnswer(invocation -> {
        Object visitorArg = invocation.getArguments()[2];
        Visitor<NodeUpdates, IndexPopulationFailedKernelException> visitor = (Visitor<NodeUpdates, IndexPopulationFailedKernelException>) visitorArg;
        return new IndexEntryUpdateScan(updates, visitor);
    });
    return storeView;
}
Also used : NodeUpdates(org.neo4j.kernel.api.index.NodeUpdates) Visitor(org.neo4j.helpers.collection.Visitor) NeoStoreIndexStoreView(org.neo4j.kernel.impl.transaction.state.storeview.NeoStoreIndexStoreView) IndexPopulationFailedKernelException(org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException)

Example 12 with Visitor

use of org.neo4j.helpers.collection.Visitor in project neo4j by neo4j.

the class TestCrashWithRebuildSlow method getHighIds.

private static Map<IdType, Long> getHighIds(GraphDatabaseAPI db) {
    final Map<IdType, Long> highIds = new HashMap<>();
    NeoStores neoStores = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class).testAccessNeoStores();
    Visitor<CommonAbstractStore, RuntimeException> visitor = new Visitor<CommonAbstractStore, RuntimeException>() {

        @Override
        public boolean visit(CommonAbstractStore store) throws RuntimeException {
            highIds.put(store.getIdType(), store.getHighId());
            return true;
        }
    };
    neoStores.visitStore(visitor);
    return highIds;
}
Also used : Visitor(org.neo4j.helpers.collection.Visitor) HashMap(java.util.HashMap) RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine) NeoStores(org.neo4j.kernel.impl.store.NeoStores) CommonAbstractStore(org.neo4j.kernel.impl.store.CommonAbstractStore) IdType(org.neo4j.kernel.impl.store.id.IdType)

Aggregations

Visitor (org.neo4j.helpers.collection.Visitor)12 IOException (java.io.IOException)7 CommittedTransactionRepresentation (org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation)7 LogicalTransactionStore (org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore)7 Response (org.neo4j.com.Response)5 TransactionIdStore (org.neo4j.kernel.impl.transaction.log.TransactionIdStore)5 File (java.io.File)4 Test (org.junit.Test)4 LogPosition (org.neo4j.kernel.impl.transaction.log.LogPosition)4 PhysicalLogFiles (org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)4 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)4 RequestContext (org.neo4j.com.RequestContext)3 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)3 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 LogFile (org.neo4j.kernel.impl.transaction.log.LogFile)3 LogHeaderCache (org.neo4j.kernel.impl.transaction.log.LogHeaderCache)3 PhysicalLogFile (org.neo4j.kernel.impl.transaction.log.PhysicalLogFile)3 LogEntryStart (org.neo4j.kernel.impl.transaction.log.entry.LogEntryStart)3 LogEntryWriter (org.neo4j.kernel.impl.transaction.log.entry.LogEntryWriter)3 StorageEngine (org.neo4j.storageengine.api.StorageEngine)3