use of org.neo4j.kernel.impl.api.StatementOperationContainer in project neo4j by neo4j.
the class NeoStoreDataSource method buildStatementOperations.
private StatementOperationContainer buildStatementOperations(StoreReadLayer storeReadLayer, AutoIndexing autoIndexing, ConstraintIndexCreator constraintIndexCreator, UpdateableSchemaState updateableSchemaState, Guard guard, LegacyIndexStore legacyIndexStore) {
// The passed in StoreReadLayer is the bottom most layer: Read-access to committed data.
// To it we add:
// + Transaction state handling
StateHandlingStatementOperations stateHandlingContext = new StateHandlingStatementOperations(storeReadLayer, autoIndexing, constraintIndexCreator, legacyIndexStore);
QueryRegistrationOperations queryRegistrationOperations = new StackingQueryRegistrationOperations(clock);
StatementOperationParts parts = new StatementOperationParts(stateHandlingContext, stateHandlingContext, stateHandlingContext, stateHandlingContext, stateHandlingContext, stateHandlingContext, new SchemaStateConcern(updateableSchemaState), null, stateHandlingContext, stateHandlingContext, stateHandlingContext, queryRegistrationOperations);
// + Constraints
ConstraintEnforcingEntityOperations constraintEnforcingEntityOperations = new ConstraintEnforcingEntityOperations(constraintSemantics, parts.entityWriteOperations(), parts.entityReadOperations(), parts.schemaWriteOperations(), parts.schemaReadOperations());
// + Data integrity
DataIntegrityValidatingStatementOperations dataIntegrityContext = new DataIntegrityValidatingStatementOperations(parts.keyWriteOperations(), parts.schemaReadOperations(), constraintEnforcingEntityOperations);
parts = parts.override(null, dataIntegrityContext, constraintEnforcingEntityOperations, constraintEnforcingEntityOperations, null, dataIntegrityContext, null, null, null, null, null, null);
// + Locking
LockingStatementOperations lockingContext = new LockingStatementOperations(parts.entityReadOperations(), parts.entityWriteOperations(), parts.schemaReadOperations(), parts.schemaWriteOperations(), parts.schemaStateOperations());
parts = parts.override(null, null, null, lockingContext, lockingContext, lockingContext, lockingContext, lockingContext, null, null, null, null);
// + Guard
GuardingStatementOperations guardingOperations = new GuardingStatementOperations(parts.entityWriteOperations(), parts.entityReadOperations(), guard);
StatementOperationParts guardedParts = parts.override(null, null, guardingOperations, guardingOperations, null, null, null, null, null, null, null, null);
return new StatementOperationContainer(guardedParts, parts);
}
use of org.neo4j.kernel.impl.api.StatementOperationContainer in project neo4j by neo4j.
the class NeoStoreDataSource method buildKernel.
private NeoStoreKernelModule buildKernel(TransactionAppender appender, IndexingService indexingService, StoreReadLayer storeLayer, UpdateableSchemaState updateableSchemaState, LabelScanStore labelScanStore, StorageEngine storageEngine, IndexConfigStore indexConfigStore, TransactionIdStore transactionIdStore, AvailabilityGuard availabilityGuard, Clock clock, PropertyAccessor propertyAccessor) throws KernelException, IOException {
TransactionCommitProcess transactionCommitProcess = commitProcessFactory.create(appender, storageEngine, config);
/*
* This is used by legacy indexes and constraint indexes whenever a transaction is to be spawned
* from within an existing transaction. It smells, and we should look over alternatives when time permits.
*/
Supplier<KernelAPI> kernelProvider = () -> kernelModule.kernelAPI();
boolean releaseSchemaLockWhenBuildingConstratinIndexes = config.get(GraphDatabaseSettings.release_schema_lock_while_building_constraint);
ConstraintIndexCreator constraintIndexCreator = new ConstraintIndexCreator(kernelProvider, indexingService, propertyAccessor, releaseSchemaLockWhenBuildingConstratinIndexes);
LegacyIndexStore legacyIndexStore = new LegacyIndexStore(config, indexConfigStore, kernelProvider, legacyIndexProviderLookup);
StatementOperationContainer statementOperationContainer = dependencies.satisfyDependency(buildStatementOperations(storeLayer, autoIndexing, constraintIndexCreator, updateableSchemaState, guard, legacyIndexStore));
TransactionHooks hooks = new TransactionHooks();
KernelTransactions kernelTransactions = life.add(new KernelTransactions(statementLocksFactory, constraintIndexCreator, statementOperationContainer, schemaWriteGuard, transactionHeaderInformationFactory, transactionCommitProcess, indexConfigStore, legacyIndexProviderLookup, hooks, transactionMonitor, availabilityGuard, tracers, storageEngine, procedures, transactionIdStore, clock, accessCapability));
final Kernel kernel = new Kernel(kernelTransactions, hooks, databaseHealth, transactionMonitor, procedures, config);
kernel.registerTransactionHook(transactionEventHandlers);
final NeoStoreFileListing fileListing = new NeoStoreFileListing(storeDir, labelScanStore, indexingService, legacyIndexProviderLookup, storageEngine);
return new NeoStoreKernelModule(transactionCommitProcess, kernel, kernelTransactions, fileListing);
}
use of org.neo4j.kernel.impl.api.StatementOperationContainer in project neo4j by neo4j.
the class GuardIT method notIncludeGuardingOperationLayerOnNonGuardingParts.
@Test
public void notIncludeGuardingOperationLayerOnNonGuardingParts() throws Exception {
GraphDatabaseAPI database = startDataBase();
DependencyResolver dependencyResolver = database.getDependencyResolver();
StatementOperationContainer operationParts = dependencyResolver.resolveDependency(StatementOperationContainer.class);
StatementOperationParts guardedParts = operationParts.nonGuarderParts();
assertThat(guardedParts.entityReadOperations(), not(instanceOf(GuardingStatementOperations.class)));
assertThat(guardedParts.entityWriteOperations(), not(instanceOf(GuardingStatementOperations.class)));
}
use of org.neo4j.kernel.impl.api.StatementOperationContainer in project neo4j by neo4j.
the class GuardIT method includeGuardingOperationLayerOnGuardingParts.
@Test
public void includeGuardingOperationLayerOnGuardingParts() throws Exception {
GraphDatabaseAPI database = startDataBase();
DependencyResolver dependencyResolver = database.getDependencyResolver();
StatementOperationContainer operationParts = dependencyResolver.resolveDependency(StatementOperationContainer.class);
StatementOperationParts guardedParts = operationParts.guardedParts();
assertThat(guardedParts.entityReadOperations(), instanceOf(GuardingStatementOperations.class));
assertThat(guardedParts.entityWriteOperations(), instanceOf(GuardingStatementOperations.class));
}
Aggregations