Search in sources :

Example 16 with TxState

use of org.neo4j.kernel.impl.api.state.TxState in project neo4j by neo4j.

the class RecordStorageReaderTestBase method createUniquenessConstraint.

protected IndexDescriptor createUniquenessConstraint(Label label, String propertyKey) throws Exception {
    IndexDescriptor index = createUniqueIndex(label, propertyKey);
    TxState txState = new TxState();
    int labelId = getOrCreateLabelId(label);
    int propertyKeyId = getOrCreatePropertyKeyId(propertyKey);
    UniquenessConstraintDescriptor constraint = ConstraintDescriptorFactory.uniqueForLabel(labelId, propertyKeyId);
    constraint = constraint.withName(index.getName()).withOwnedIndexId(index.getId());
    txState.constraintDoAdd(constraint);
    apply(txState);
    return index;
}
Also used : TxState(org.neo4j.kernel.impl.api.state.TxState) UniquenessConstraintDescriptor(org.neo4j.internal.schema.constraints.UniquenessConstraintDescriptor) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor)

Example 17 with TxState

use of org.neo4j.kernel.impl.api.state.TxState in project neo4j by neo4j.

the class RecordStorageReaderTestBase method deleteNode.

protected void deleteNode(long nodeId) throws Exception {
    TxState txState = new TxState();
    txState.nodeDoDelete(nodeId);
    apply(txState);
}
Also used : TxState(org.neo4j.kernel.impl.api.state.TxState)

Aggregations

TxState (org.neo4j.kernel.impl.api.state.TxState)17 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)5 ArrayList (java.util.ArrayList)3 CommandCreationContext (org.neo4j.storageengine.api.CommandCreationContext)3 StorageCommand (org.neo4j.storageengine.api.StorageCommand)3 Test (org.junit.jupiter.api.Test)2 CursorContext (org.neo4j.io.pagecache.context.CursorContext)2 TransactionState (org.neo4j.kernel.api.txstate.TransactionState)2 IOException (java.io.IOException)1 DirectoryNotEmptyException (java.nio.file.DirectoryNotEmptyException)1 List (java.util.List)1 Map (java.util.Map)1 Stream (java.util.stream.Stream)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertFalse (org.junit.jupiter.api.Assertions.assertFalse)1 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Dependencies (org.neo4j.collection.Dependencies)1