Search in sources :

Example 11 with DependencyResolver

use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.

the class ExecutionEngine method makeExecutionEngine.

protected static org.neo4j.cypher.internal.ExecutionEngine makeExecutionEngine(GraphDatabaseQueryService queryService, CaffeineCacheFactory cacheFactory, LogProvider logProvider, CompilerLibrary compilerLibrary) {
    DependencyResolver resolver = queryService.getDependencyResolver();
    Monitors monitors = resolver.resolveDependency(Monitors.class);
    MonitoringCacheTracer cacheTracer = new MonitoringCacheTracer(monitors.newMonitor(ExecutionEngineQueryCacheMonitor.class));
    Config config = resolver.resolveDependency(Config.class);
    CypherConfiguration cypherConfiguration = CypherConfiguration.fromConfig(config);
    CompilationTracer tracer = new TimingCompilationTracer(monitors.newMonitor(TimingCompilationTracer.EventListener.class));
    return new org.neo4j.cypher.internal.ExecutionEngine(queryService, monitors, tracer, cacheTracer, cypherConfiguration, compilerLibrary, cacheFactory, logProvider, Clock.systemUTC());
}
Also used : TimingCompilationTracer(org.neo4j.cypher.internal.tracing.TimingCompilationTracer) CompilationTracer(org.neo4j.cypher.internal.tracing.CompilationTracer) QueryExecutionEngine(org.neo4j.kernel.impl.query.QueryExecutionEngine) ExecutionEngineQueryCacheMonitor(org.neo4j.cypher.internal.ExecutionEngineQueryCacheMonitor) Config(org.neo4j.configuration.Config) Monitors(org.neo4j.monitoring.Monitors) TimingCompilationTracer(org.neo4j.cypher.internal.tracing.TimingCompilationTracer) CypherConfiguration(org.neo4j.cypher.internal.config.CypherConfiguration) DependencyResolver(org.neo4j.common.DependencyResolver)

Example 12 with DependencyResolver

use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.

the class UniqueConstraintCompatibility method resolveInternalDependency.

private <T> T resolveInternalDependency(Class<T> type) {
    GraphDatabaseAPI api = (GraphDatabaseAPI) db;
    DependencyResolver resolver = api.getDependencyResolver();
    return resolver.resolveDependency(type);
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) DependencyResolver(org.neo4j.common.DependencyResolver)

Example 13 with DependencyResolver

use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.

the class DatabaseManagementServiceBuilderIT method startSystemAndDefaultDatabase.

@Test
void startSystemAndDefaultDatabase() {
    DatabaseManagementService managementService = getDbmsBuilderWithLimitedTxLogSize(testDirectory.homePath()).build();
    GraphDatabaseAPI database = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
    try {
        DependencyResolver dependencyResolver = database.getDependencyResolver();
        DatabaseManager<?> databaseManager = dependencyResolver.resolveDependency(DatabaseManager.class);
        assertThat(databaseManager.getDatabaseContext(DEFAULT_DATABASE_NAME)).isNotEmpty();
        assertThat(databaseManager.getDatabaseContext(NAMED_SYSTEM_DATABASE_ID)).isNotEmpty();
    } finally {
        managementService.shutdown();
    }
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) DependencyResolver(org.neo4j.common.DependencyResolver) Test(org.junit.jupiter.api.Test)

Example 14 with DependencyResolver

use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.

the class GraphStoreFixture method startDatabaseAndExtractComponents.

private void startDatabaseAndExtractComponents() {
    managementService = new TestDatabaseManagementServiceBuilder(testDirectory.homePath()).setFileSystem(testDirectory.getFileSystem()).setConfig(GraphDatabaseSettings.record_format, formatName).setConfig(GraphDatabaseInternalSettings.label_block_size, 60).setConfig(GraphDatabaseInternalSettings.consistency_check_on_apply, false).setConfig(getConfig()).build();
    database = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
    DependencyResolver dependencyResolver = database.getDependencyResolver();
    commitProcess = new InternalTransactionCommitProcess(dependencyResolver.resolveDependency(TransactionAppender.class), dependencyResolver.resolveDependency(StorageEngine.class));
    transactionIdStore = database.getDependencyResolver().resolveDependency(TransactionIdStore.class);
    storageEngine = dependencyResolver.resolveDependency(RecordStorageEngine.class);
    neoStores = storageEngine.testAccessNeoStores();
    indexingService = dependencyResolver.resolveDependency(IndexingService.class);
    directStoreAccess = new DirectStoreAccess(neoStores, dependencyResolver.resolveDependency(IndexProviderMap.class), dependencyResolver.resolveDependency(TokenHolders.class), dependencyResolver.resolveDependency(IndexStatisticsStore.class), dependencyResolver.resolveDependency(IdGeneratorFactory.class));
    countsStore = storageEngine.countsAccessor();
    groupDegreesStore = storageEngine.relationshipGroupDegreesStore();
    pageCache = dependencyResolver.resolveDependency(PageCache.class);
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) TransactionIdStore(org.neo4j.storageengine.api.TransactionIdStore) RecordStorageEngine(org.neo4j.internal.recordstorage.RecordStorageEngine) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) DirectStoreAccess(org.neo4j.consistency.store.DirectStoreAccess) InternalTransactionCommitProcess(org.neo4j.kernel.impl.api.InternalTransactionCommitProcess) PageCache(org.neo4j.io.pagecache.PageCache) DependencyResolver(org.neo4j.common.DependencyResolver)

Example 15 with DependencyResolver

use of org.neo4j.common.DependencyResolver in project neo4j by neo4j.

the class DenseNodeConcurrencyIT method consistencyCheck.

@AfterAll
void consistencyCheck() throws ConsistencyCheckIncompleteException, IOException {
    try {
        DependencyResolver deps = database.getDependencyResolver();
        Config config = deps.resolveDependency(Config.class);
        DatabaseLayout databaseLayout = database.databaseLayout();
        dbms.shutdown();
        ConsistencyCheckService.Result result = new ConsistencyCheckService().runFullConsistencyCheck(databaseLayout, config, NONE, nullLogProvider(), deps.resolveDependency(FileSystemAbstraction.class), false, ConsistencyFlags.DEFAULT);
        assertThat(result.isSuccessful()).as(new Description() {

            @Override
            public String value() {
                return consistencyCheckReportAsString(result);
            }
        }).isTrue();
    } finally {
        fs.close();
    }
}
Also used : UncloseableDelegatingFileSystemAbstraction(org.neo4j.io.fs.UncloseableDelegatingFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) Description(org.assertj.core.description.Description) Config(org.neo4j.configuration.Config) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) DependencyResolver(org.neo4j.common.DependencyResolver) AfterAll(org.junit.jupiter.api.AfterAll)

Aggregations

DependencyResolver (org.neo4j.common.DependencyResolver)41 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)13 Config (org.neo4j.configuration.Config)12 Test (org.junit.jupiter.api.Test)10 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)8 DatabaseContext (org.neo4j.dbms.database.DatabaseContext)6 GraphDatabaseFacade (org.neo4j.kernel.impl.factory.GraphDatabaseFacade)5 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)5 GraphDatabaseQueryService (org.neo4j.kernel.GraphDatabaseQueryService)4 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)4 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)4 SystemGraphComponents (org.neo4j.dbms.database.SystemGraphComponents)3 Transaction (org.neo4j.graphdb.Transaction)3 IdGeneratorFactory (org.neo4j.internal.id.IdGeneratorFactory)3 PageCache (org.neo4j.io.pagecache.PageCache)3 CheckPointer (org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointer)3 SimpleTriggerInfo (org.neo4j.kernel.impl.transaction.log.checkpoint.SimpleTriggerInfo)3 TokenHolders (org.neo4j.token.TokenHolders)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2