use of org.neo4j.kernel.api.txstate.TransactionState in project neo4j by neo4j.
the class Operations method nodeCreate.
@Override
public long nodeCreate() {
ktx.securityAuthorizationHandler().assertAllowsCreateNode(ktx.securityContext(), token::labelGetName, null);
ktx.assertOpen();
TransactionState txState = ktx.txState();
long nodeId = commandCreationContext.reserveNode();
txState.nodeDoCreate(nodeId);
return nodeId;
}
use of org.neo4j.kernel.api.txstate.TransactionState in project neo4j by neo4j.
the class Operations method indexDoCreate.
private IndexDescriptor indexDoCreate(IndexPrototype prototype) {
indexProviders.validateIndexPrototype(prototype);
TransactionState transactionState = ktx.txState();
long schemaRecordId = commandCreationContext.reserveSchema();
IndexDescriptor index = prototype.materialise(schemaRecordId);
index = indexProviders.completeConfiguration(index);
transactionState.indexDoAdd(index);
return index;
}
use of org.neo4j.kernel.api.txstate.TransactionState in project neo4j by neo4j.
the class Operations method nodeDelete.
private boolean nodeDelete(long node, boolean lock) {
ktx.assertOpen();
if (ktx.hasTxStateWithChanges()) {
TransactionState state = ktx.txState();
if (state.nodeIsAddedInThisTx(node)) {
try {
singleNode(node);
} catch (EntityNotFoundException e) {
throw new IllegalStateException("Node " + node + " was created in this transaction, but was not found when it was about to be deleted");
}
updater.onDeleteUncreated(nodeCursor, propertyCursor);
state.nodeDoDelete(node);
return true;
}
if (state.nodeIsDeletedInThisTx(node)) {
// already deleted
return false;
}
}
if (lock) {
commandCreationContext.acquireNodeDeletionLock(ktx.txState(), ktx.lockClient(), ktx.lockTracer(), node);
}
allStoreHolder.singleNode(node, nodeCursor);
if (nodeCursor.next()) {
acquireSharedNodeLabelLocks();
sharedTokenSchemaLock(ResourceTypes.LABEL);
ktx.securityAuthorizationHandler().assertAllowsDeleteNode(ktx.securityContext(), token::labelGetName, nodeCursor::labels);
ktx.txState().nodeDoDelete(node);
return true;
}
// tried to delete node that does not exist
return false;
}
Aggregations