Search in sources :

Example 1 with TransactionCountingStateVisitor

use of org.neo4j.kernel.api.txstate.TransactionCountingStateVisitor in project neo4j by neo4j.

the class RecordStorageEngine method createCommands.

@SuppressWarnings("resource")
@Override
public void createCommands(Collection<StorageCommand> commands, ReadableTransactionState txState, StorageStatement storageStatement, ResourceLocker locks, long lastTransactionIdWhenStarted) throws TransactionFailureException, CreateConstraintFailureException, ConstraintValidationException {
    if (txState != null) {
        RecordChangeSet recordChangeSet = new RecordChangeSet(loaders);
        TransactionRecordState recordState = new TransactionRecordState(neoStores, integrityValidator, recordChangeSet, lastTransactionIdWhenStarted, locks, relationshipCreator, relationshipDeleter, propertyCreator, propertyDeleter);
        // Visit transaction state and populate these record state objects
        TxStateVisitor txStateVisitor = new TransactionToRecordStateVisitor(recordState, schemaStateChangeCallback, schemaStorage, constraintSemantics, schemaIndexProviderMap);
        CountsRecordState countsRecordState = new CountsRecordState();
        txStateVisitor = constraintSemantics.decorateTxStateVisitor(storeLayer, txState, txStateVisitor);
        txStateVisitor = new TransactionCountingStateVisitor(txStateVisitor, storeLayer, storageStatement, txState, countsRecordState);
        try (TxStateVisitor visitor = txStateVisitor) {
            txState.accept(txStateVisitor);
        }
        // Convert record state into commands
        recordState.extractCommands(commands);
        countsRecordState.extractCommands(commands);
    }
}
Also used : RecordChangeSet(org.neo4j.kernel.impl.transaction.state.RecordChangeSet) TxStateVisitor(org.neo4j.storageengine.api.txstate.TxStateVisitor) TransactionRecordState(org.neo4j.kernel.impl.transaction.state.TransactionRecordState) CountsRecordState(org.neo4j.kernel.impl.api.CountsRecordState) TransactionCountingStateVisitor(org.neo4j.kernel.api.txstate.TransactionCountingStateVisitor)

Aggregations

TransactionCountingStateVisitor (org.neo4j.kernel.api.txstate.TransactionCountingStateVisitor)1 CountsRecordState (org.neo4j.kernel.impl.api.CountsRecordState)1 RecordChangeSet (org.neo4j.kernel.impl.transaction.state.RecordChangeSet)1 TransactionRecordState (org.neo4j.kernel.impl.transaction.state.TransactionRecordState)1 TxStateVisitor (org.neo4j.storageengine.api.txstate.TxStateVisitor)1