Search in sources :

Example 6 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class DatabaseIT method configure.

@ExtensionCallback
void configure(TestDatabaseManagementServiceBuilder builder) {
    Dependencies dependencies = new Dependencies();
    pageCacheWrapper = new PageCacheWrapper(pageCacheExtension.getPageCache(fs));
    dependencies.satisfyDependency(pageCacheWrapper);
    builder.setInternalLogProvider(logProvider).setExternalDependencies(dependencies);
}
Also used : Dependencies(org.neo4j.collection.Dependencies) ExtensionCallback(org.neo4j.test.extension.ExtensionCallback)

Example 7 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class Recovery method instantiateRecoveryExtensions.

private static DatabaseExtensions instantiateRecoveryExtensions(DatabaseLayout databaseLayout, FileSystemAbstraction fileSystem, Config config, LogService logService, PageCache pageCache, JobScheduler jobScheduler, DbmsInfo dbmsInfo, Monitors monitors, TokenHolders tokenHolders, RecoveryCleanupWorkCollector recoveryCleanupCollector, DatabaseReadOnlyChecker readOnlyChecker, Iterable<ExtensionFactory<?>> extensionFactories, PageCacheTracer pageCacheTracer) {
    List<ExtensionFactory<?>> recoveryExtensions = stream(extensionFactories).filter(extension -> extension.getClass().isAnnotationPresent(RecoveryExtension.class)).collect(toList());
    Dependencies deps = new Dependencies();
    NonListenableMonitors nonListenableMonitors = new NonListenableMonitors(monitors, logService.getInternalLogProvider());
    deps.satisfyDependencies(fileSystem, config, logService, pageCache, nonListenableMonitors, jobScheduler, tokenHolders, recoveryCleanupCollector, pageCacheTracer, databaseLayout, readOnlyChecker);
    DatabaseExtensionContext extensionContext = new DatabaseExtensionContext(databaseLayout, dbmsInfo, deps);
    return new DatabaseExtensions(extensionContext, recoveryExtensions, deps, ExtensionFailureStrategies.fail());
}
Also used : DatabaseExtensionContext(org.neo4j.kernel.extension.context.DatabaseExtensionContext) DefaultIdController(org.neo4j.internal.id.DefaultIdController) LogFilesBuilder(org.neo4j.kernel.impl.transaction.log.files.LogFilesBuilder) Config(org.neo4j.configuration.Config) NullLogProvider(org.neo4j.logging.NullLogProvider) VersionAwareLogEntryReader(org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader) IndexStatisticsStore(org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore) DatabasePageCache(org.neo4j.dbms.database.DatabasePageCache) ReadOnlyTokenCreator(org.neo4j.token.ReadOnlyTokenCreator) PageCacheTracer(org.neo4j.io.pagecache.tracing.PageCacheTracer) RecoveryCleanupWorkCollector(org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector) NullLog(org.neo4j.logging.NullLog) Path(java.nio.file.Path) INDEX_CLEANUP_WORK(org.neo4j.scheduler.Group.INDEX_CLEANUP_WORK) EMPTY_CHECKER(org.neo4j.kernel.recovery.RecoveryStartupChecker.EMPTY_CHECKER) TransactionLogFilesHelper(org.neo4j.kernel.impl.transaction.log.files.TransactionLogFilesHelper) StorageFilesState(org.neo4j.storageengine.api.StorageFilesState) Dependencies(org.neo4j.collection.Dependencies) IOController(org.neo4j.io.pagecache.IOController) FullScanStoreView(org.neo4j.kernel.impl.transaction.state.storeview.FullScanStoreView) Services(org.neo4j.service.Services) SimpleTriggerInfo(org.neo4j.kernel.impl.transaction.log.checkpoint.SimpleTriggerInfo) Database(org.neo4j.kernel.database.Database) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) Tracers(org.neo4j.kernel.monitoring.tracing.Tracers) VersionContextSupplier(org.neo4j.io.pagecache.context.VersionContextSupplier) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) RecoveryThreshold(org.neo4j.kernel.impl.transaction.log.checkpoint.RecoveryThreshold) DefaultForceOperation(org.neo4j.kernel.database.DefaultForceOperation) DelegatingTokenHolder(org.neo4j.token.DelegatingTokenHolder) TYPE_PROPERTY_KEY(org.neo4j.token.api.TokenHolder.TYPE_PROPERTY_KEY) DatabaseExtensions(org.neo4j.kernel.extension.DatabaseExtensions) DefaultIndexProviderMap(org.neo4j.kernel.impl.transaction.state.DefaultIndexProviderMap) MemoryTracker(org.neo4j.memory.MemoryTracker) Lifecycle(org.neo4j.kernel.lifecycle.Lifecycle) PanicEventGenerator(org.neo4j.monitoring.PanicEventGenerator) TransactionMetadataCache(org.neo4j.kernel.impl.transaction.log.TransactionMetadataCache) IOException(java.io.IOException) DatabaseTracers(org.neo4j.kernel.database.DatabaseTracers) ExtensionFactory(org.neo4j.kernel.extension.ExtensionFactory) TokenHolders(org.neo4j.token.TokenHolders) TYPE_LABEL(org.neo4j.token.api.TokenHolder.TYPE_LABEL) StoreCopyCheckPointMutex(org.neo4j.kernel.impl.transaction.log.checkpoint.StoreCopyCheckPointMutex) LifecycleAdapter(org.neo4j.kernel.lifecycle.LifecycleAdapter) Log(org.neo4j.logging.Log) BatchingTransactionAppender(org.neo4j.kernel.impl.transaction.log.BatchingTransactionAppender) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) LogRotation(org.neo4j.kernel.impl.transaction.log.rotation.LogRotation) RecoveryState(org.neo4j.storageengine.api.RecoveryState) Monitors(org.neo4j.monitoring.Monitors) LogVersionRepository(org.neo4j.storageengine.api.LogVersionRepository) CheckPointerImpl(org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointerImpl) DatabaseSchemaState(org.neo4j.kernel.impl.api.DatabaseSchemaState) JobSchedulerFactory(org.neo4j.kernel.impl.scheduler.JobSchedulerFactory) PageCache(org.neo4j.io.pagecache.PageCache) LegacyTransactionLogsLocator(org.neo4j.kernel.impl.storemigration.LegacyTransactionLogsLocator) StorageEngine(org.neo4j.storageengine.api.StorageEngine) DatabaseReadOnlyChecker.writable(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker.writable) LogProgressReporter(org.neo4j.kernel.impl.util.monitoring.LogProgressReporter) String.format(java.lang.String.format) List(java.util.List) NO_LOCK_SERVICE(org.neo4j.lock.LockService.NO_LOCK_SERVICE) SimpleLogService(org.neo4j.logging.internal.SimpleLogService) Optional(java.util.Optional) DatabaseReadOnlyChecker(org.neo4j.configuration.helpers.DatabaseReadOnlyChecker) TYPE_RELATIONSHIP_TYPE(org.neo4j.token.api.TokenHolder.TYPE_RELATIONSHIP_TYPE) PhysicalLogicalTransactionStore(org.neo4j.kernel.impl.transaction.log.PhysicalLogicalTransactionStore) LogFiles(org.neo4j.kernel.impl.transaction.log.files.LogFiles) LogicalTransactionStore(org.neo4j.kernel.impl.transaction.log.LogicalTransactionStore) Config.defaults(org.neo4j.configuration.Config.defaults) ProgressReporter(org.neo4j.common.ProgressReporter) GraphDatabaseSettings(org.neo4j.configuration.GraphDatabaseSettings) LogProvider(org.neo4j.logging.LogProvider) ConfiguringPageCacheFactory(org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory) GroupingRecoveryCleanupWorkCollector(org.neo4j.index.internal.gbptree.GroupingRecoveryCleanupWorkCollector) Clocks.systemClock(org.neo4j.time.Clocks.systemClock) Iterables(org.neo4j.internal.helpers.collection.Iterables) Objects.requireNonNull(java.util.Objects.requireNonNull) StoreId(org.neo4j.storageengine.api.StoreId) GraphDatabaseInternalSettings(org.neo4j.configuration.GraphDatabaseInternalSettings) DbmsInfo(org.neo4j.kernel.impl.factory.DbmsInfo) LogPruning(org.neo4j.kernel.impl.transaction.log.pruning.LogPruning) MemoryPools(org.neo4j.memory.MemoryPools) IndexStoreViewFactory(org.neo4j.kernel.impl.transaction.state.storeview.IndexStoreViewFactory) JobScheduler(org.neo4j.scheduler.JobScheduler) Iterables.stream(org.neo4j.internal.helpers.collection.Iterables.stream) DatabaseHealth(org.neo4j.monitoring.DatabaseHealth) NO_LOCKS(org.neo4j.kernel.impl.locking.Locks.NO_LOCKS) ConstraintSemantics.getConstraintSemantics(org.neo4j.kernel.impl.constraints.ConstraintSemantics.getConstraintSemantics) LogService(org.neo4j.logging.internal.LogService) StorageEngineFactory(org.neo4j.storageengine.api.StorageEngineFactory) INDEX_CLEANUP(org.neo4j.scheduler.Group.INDEX_CLEANUP) MetadataProvider(org.neo4j.storageengine.api.MetadataProvider) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) Collectors.toList(java.util.stream.Collectors.toList) StorageEngineFactory.selectStorageEngine(org.neo4j.storageengine.api.StorageEngineFactory.selectStorageEngine) Clock(java.time.Clock) ExtensionFailureStrategies(org.neo4j.kernel.extension.ExtensionFailureStrategies) TransactionIdStore(org.neo4j.storageengine.api.TransactionIdStore) Clocks(org.neo4j.time.Clocks) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) EmptyVersionContextSupplier(org.neo4j.io.pagecache.context.EmptyVersionContextSupplier) ExtensionFactory(org.neo4j.kernel.extension.ExtensionFactory) DatabaseExtensionContext(org.neo4j.kernel.extension.context.DatabaseExtensionContext) DatabaseExtensions(org.neo4j.kernel.extension.DatabaseExtensions) Dependencies(org.neo4j.collection.Dependencies)

Example 8 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class CommunityEditionModule method setupSecurityGraphInitializer.

private void setupSecurityGraphInitializer(GlobalModule globalModule) {
    Config config = globalModule.getGlobalConfig();
    FileSystemAbstraction fileSystem = globalModule.getFileSystem();
    LogProvider logProvider = globalModule.getLogService().getUserLogProvider();
    AbstractSecurityLog securityLog = new CommunitySecurityLog((LogExtended) logProvider.getLog(UserSecurityGraphComponent.class));
    var communityComponent = CommunitySecurityModule.createSecurityComponent(securityLog, config, fileSystem, logProvider);
    Dependencies dependencies = globalModule.getGlobalDependencies();
    SystemGraphComponents systemGraphComponents = dependencies.resolveDependency(SystemGraphComponents.class);
    systemGraphComponents.register(communityComponent);
}
Also used : SystemGraphComponents(org.neo4j.dbms.database.SystemGraphComponents) LogProvider(org.neo4j.logging.LogProvider) CommunitySecurityLog(org.neo4j.internal.kernel.api.security.CommunitySecurityLog) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) Config(org.neo4j.configuration.Config) AbstractSecurityLog(org.neo4j.internal.kernel.api.security.AbstractSecurityLog) Dependencies(org.neo4j.collection.Dependencies)

Example 9 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class StoreUpgraderInterruptionTestIT method newUpgrader.

private StoreUpgrader newUpgrader(StoreVersionCheck versionCheck, MigrationProgressMonitor progressMonitor, StoreMigrationParticipant... participants) {
    Config config = Config.defaults(allow_upgrade, true);
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependencies(new Monitors());
    RecordStorageEngineFactory storageEngineFactory = new RecordStorageEngineFactory();
    var databaseHealth = new DatabaseHealth(PanicEventGenerator.NO_OP, NullLog.getInstance());
    LogsUpgrader logsUpgrader = new LogsUpgrader(fs, storageEngineFactory, workingDatabaseLayout, pageCache, legacyTransactionLogsLocator, config, dependencies, NULL, INSTANCE, databaseHealth, false);
    StoreUpgrader upgrader = new StoreUpgrader(versionCheck, progressMonitor, config, fs, NullLogProvider.getInstance(), logsUpgrader, NULL);
    for (StoreMigrationParticipant participant : participants) {
        upgrader.addParticipant(participant);
    }
    return upgrader;
}
Also used : DatabaseHealth(org.neo4j.monitoring.DatabaseHealth) RecordStorageEngineFactory(org.neo4j.internal.recordstorage.RecordStorageEngineFactory) LogsUpgrader(org.neo4j.kernel.impl.storemigration.LogsUpgrader) Config(org.neo4j.configuration.Config) StoreMigrationParticipant(org.neo4j.storageengine.migration.StoreMigrationParticipant) Monitors(org.neo4j.monitoring.Monitors) Dependencies(org.neo4j.collection.Dependencies) StoreUpgrader(org.neo4j.kernel.impl.storemigration.StoreUpgrader)

Example 10 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class DbmsDiagnosticsManagerTest method prepareDatabase.

private Database prepareDatabase(NamedDatabaseId databaseId) throws IOException {
    Database database = mock(Database.class);
    Dependencies databaseDependencies = new Dependencies();
    databaseDependencies.satisfyDependency(DbmsInfo.COMMUNITY);
    databaseDependencies.satisfyDependency(storageEngine);
    databaseDependencies.satisfyDependency(storageEngineFactory);
    databaseDependencies.satisfyDependency(new DefaultFileSystemAbstraction());
    databaseDependencies.satisfyDependency(logFilesBasedOnlyBuilder(directory.homePath(), directory.getFileSystem()).withLogEntryReader(mock(LogEntryReader.class)).build());
    when(database.getDependencyResolver()).thenReturn(databaseDependencies);
    when(database.getNamedDatabaseId()).thenReturn(databaseId);
    when(database.isStarted()).thenReturn(true);
    when(database.getDatabaseLayout()).thenReturn(DatabaseLayout.ofFlat(directory.homePath()));
    return database;
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) Database(org.neo4j.kernel.database.Database) LogEntryReader(org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader) Dependencies(org.neo4j.collection.Dependencies)

Aggregations

Dependencies (org.neo4j.collection.Dependencies)40 Test (org.junit.jupiter.api.Test)13 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)7 Config (org.neo4j.configuration.Config)6 Monitors (org.neo4j.monitoring.Monitors)6 PageCache (org.neo4j.io.pagecache.PageCache)5 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)5 DatabaseHealth (org.neo4j.monitoring.DatabaseHealth)5 StorageEngine (org.neo4j.storageengine.api.StorageEngine)5 BeforeEach (org.junit.jupiter.api.BeforeEach)4 DatabaseReadOnlyChecker (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker)4 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)4 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)4 Database (org.neo4j.kernel.database.Database)4 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)4 StorageEngineFactory (org.neo4j.storageengine.api.StorageEngineFactory)4 IOException (java.io.IOException)3 RecoveryCleanupWorkCollector (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)3 GlobalExtensionContext (org.neo4j.kernel.extension.context.GlobalExtensionContext)3 IndexStatisticsStore (org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore)3