public virtual NeoStoreDataSource GetDataSource(DatabaseLayout databaseLayout, FileSystemAbstraction fs, PageCache pageCache, DependencyResolver otherCustomOverriddenDependencies) { ShutdownAnyRunning(); StatementLocksFactory locksFactory = mock(typeof(StatementLocksFactory)); StatementLocks statementLocks = mock(typeof(StatementLocks)); Org.Neo4j.Kernel.impl.locking.Locks_Client locks = mock(typeof(Org.Neo4j.Kernel.impl.locking.Locks_Client)); when(statementLocks.Optimistic()).thenReturn(locks); when(statementLocks.Pessimistic()).thenReturn(locks); when(locksFactory.NewInstance()).thenReturn(statementLocks); JobScheduler jobScheduler = mock(typeof(JobScheduler), RETURNS_MOCKS); Monitors monitors = new Monitors(); Dependencies mutableDependencies = new Dependencies(otherCustomOverriddenDependencies); // Satisfy non-satisfied dependencies Config config = Dependency(mutableDependencies, typeof(Config), deps => Config.defaults()); config.augment(default_schema_provider, EMPTY.ProviderDescriptor.name()); LogService logService = Dependency(mutableDependencies, typeof(LogService), deps => new SimpleLogService(NullLogProvider.Instance)); IdGeneratorFactory idGeneratorFactory = Dependency(mutableDependencies, typeof(IdGeneratorFactory), deps => new DefaultIdGeneratorFactory(fs)); IdTypeConfigurationProvider idConfigurationProvider = Dependency(mutableDependencies, typeof(IdTypeConfigurationProvider), deps => new CommunityIdTypeConfigurationProvider()); DatabaseHealth databaseHealth = Dependency(mutableDependencies, typeof(DatabaseHealth), deps => new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLog.Instance)); SystemNanoClock clock = Dependency(mutableDependencies, typeof(SystemNanoClock), deps => Clocks.nanoClock()); TransactionMonitor transactionMonitor = Dependency(mutableDependencies, typeof(TransactionMonitor), deps => new DatabaseTransactionStats()); DatabaseAvailabilityGuard databaseAvailabilityGuard = Dependency(mutableDependencies, typeof(DatabaseAvailabilityGuard), deps => new DatabaseAvailabilityGuard(DEFAULT_DATABASE_NAME, deps.resolveDependency(typeof(SystemNanoClock)), NullLog.Instance)); Dependency(mutableDependencies, typeof(DiagnosticsManager), deps => new DiagnosticsManager(NullLog.Instance)); Dependency(mutableDependencies, typeof(IndexProvider), deps => EMPTY); _dataSource = new NeoStoreDataSource(new TestDatabaseCreationContext(DEFAULT_DATABASE_NAME, databaseLayout, config, idGeneratorFactory, logService, mock(typeof(JobScheduler), RETURNS_MOCKS), mock(typeof(TokenNameLookup)), mutableDependencies, mockedTokenHolders(), locksFactory, mock(typeof(SchemaWriteGuard)), mock(typeof(TransactionEventHandlers)), IndexingService.NO_MONITOR, fs, transactionMonitor, databaseHealth, mock(typeof(LogFileCreationMonitor)), TransactionHeaderInformationFactory.DEFAULT, new CommunityCommitProcessFactory(), mock(typeof(InternalAutoIndexing)), mock(typeof(IndexConfigStore)), mock(typeof(ExplicitIndexProvider)), pageCache, new StandardConstraintSemantics(), monitors, new Tracers("null", NullLog.Instance, monitors, jobScheduler, clock), mock(typeof(Procedures)), Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited, databaseAvailabilityGuard, clock, new CanWrite(), new StoreCopyCheckPointMutex(), RecoveryCleanupWorkCollector.immediate(), new BufferedIdController(new BufferingIdGeneratorFactory(idGeneratorFactory, Org.Neo4j.Kernel.impl.store.id.IdReuseEligibility_Fields.Always, idConfigurationProvider), jobScheduler), DatabaseInfo.COMMUNITY, new TransactionVersionContextSupplier(), ON_HEAP, Collections.emptyList(), file => EMPTY_WATCHER, new GraphDatabaseFacade(), Iterables.empty())); return(_dataSource); }
public ReplicatedIdGeneratorFactory(FileSystemAbstraction fs, ReplicatedIdRangeAcquirer idRangeAcquirer, LogProvider logProvider, IdTypeConfigurationProvider idTypeConfigurationProvider) { this._fs = fs; this._idRangeAcquirer = idRangeAcquirer; this._logProvider = logProvider; this._idTypeConfigurationProvider = idTypeConfigurationProvider; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void reusableTypeConfiguration() public virtual void ReusableTypeConfiguration() { IdTypeConfigurationProvider provider = CreateIdTypeProvider(); IdTypeConfiguration typeConfiguration = provider.GetIdTypeConfiguration(_reusableType); assertTrue(typeConfiguration.AllowAggressiveReuse()); assertEquals(IdTypeConfiguration.AGGRESSIVE_GRAB_SIZE, typeConfiguration.GrabSize); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void nonReusableTypeConfiguration() public virtual void NonReusableTypeConfiguration() { IdTypeConfigurationProvider provider = CreateIdTypeProvider(); IdTypeConfiguration typeConfiguration = provider.GetIdTypeConfiguration(IdType.RELATIONSHIP); assertFalse("Relationship ids are not reusable.", typeConfiguration.AllowAggressiveReuse()); assertEquals("Relationship ids are not reusable.", IdTypeConfiguration.DEFAULT_GRAB_SIZE, typeConfiguration.GrabSize); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void nonReusableTypeConfiguration() public virtual void NonReusableTypeConfiguration() { IdTypeConfigurationProvider provider = CreateIdTypeProvider(); IdTypeConfiguration typeConfiguration = provider.GetIdTypeConfiguration(IdType.SCHEMA); assertFalse("Schema record ids are not reusable.", typeConfiguration.AllowAggressiveReuse()); assertEquals("Schema record ids are not reusable.", 1024, typeConfiguration.GrabSize); }
public HaIdGeneratorFactory(DelegateInvocationHandler <Master> master, LogProvider logProvider, RequestContextFactory requestContextFactory, FileSystemAbstraction fs, IdTypeConfigurationProvider idTypeConfigurationProvider) { this._fs = fs; this._idTypeConfigurationProvider = idTypeConfigurationProvider; this._localFactory = new DefaultIdGeneratorFactory(fs, idTypeConfigurationProvider); this._master = master; this._log = logProvider.getLog(this.GetType()); this._requestContextFactory = requestContextFactory; }
public DefaultIdGeneratorFactory(FileSystemAbstraction fs, IdTypeConfigurationProvider idTypeConfigurationProvider) { this._fs = fs; this._idTypeConfigurationProvider = idTypeConfigurationProvider; }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private org.neo4j.kernel.impl.store.id.IdGeneratorFactory createIdGeneratorFactory(org.neo4j.io.fs.FileSystemAbstraction fileSystem, final org.neo4j.causalclustering.core.state.machines.id.ReplicatedIdRangeAcquirer idRangeAcquirer, final org.neo4j.logging.LogProvider logProvider, org.neo4j.kernel.impl.store.id.configuration.IdTypeConfigurationProvider idTypeConfigurationProvider) private IdGeneratorFactory CreateIdGeneratorFactory(FileSystemAbstraction fileSystem, ReplicatedIdRangeAcquirer idRangeAcquirer, LogProvider logProvider, IdTypeConfigurationProvider idTypeConfigurationProvider) { return(new ReplicatedIdGeneratorFactory(fileSystem, idRangeAcquirer, logProvider, idTypeConfigurationProvider)); }
public CoreStateMachinesModule(MemberId myself, PlatformModule platformModule, File clusterStateDirectory, Config config, RaftReplicator replicator, RaftMachine raftMachine, Dependencies dependencies, LocalDatabase localDatabase) { StateStorage <IdAllocationState> idAllocationState; StateStorage <ReplicatedLockTokenState> lockTokenState; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.lifecycle.LifeSupport life = platformModule.life; LifeSupport life = platformModule.Life; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.io.fs.FileSystemAbstraction fileSystem = platformModule.fileSystem; FileSystemAbstraction fileSystem = platformModule.FileSystem; LogService logging = platformModule.Logging; LogProvider logProvider = logging.InternalLogProvider; lockTokenState = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, LOCK_TOKEN_NAME, new ReplicatedLockTokenState.Marshal(new MemberId.Marshal()), config.Get(replicated_lock_token_state_size), logProvider)); idAllocationState = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, ID_ALLOCATION_NAME, new IdAllocationState.Marshal(), config.Get(id_alloc_state_size), logProvider)); ReplicatedIdAllocationStateMachine idAllocationStateMachine = new ReplicatedIdAllocationStateMachine(idAllocationState); IDictionary <IdType, int> allocationSizes = GetIdTypeAllocationSizeFromConfig(config); ReplicatedIdRangeAcquirer idRangeAcquirer = new ReplicatedIdRangeAcquirer(replicator, idAllocationStateMachine, allocationSizes, myself, logProvider); IdTypeConfigurationProvider = new EnterpriseIdTypeConfigurationProvider(config); CommandIndexTracker commandIndexTracker = dependencies.SatisfyDependency(new CommandIndexTracker()); FreeIdCondition = new IdReusabilityCondition(commandIndexTracker, raftMachine, myself); this.IdGeneratorFactory = CreateIdGeneratorFactory(fileSystem, idRangeAcquirer, logProvider, IdTypeConfigurationProvider); TokenRegistry relationshipTypeTokenRegistry = new TokenRegistry(Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_RELATIONSHIP_TYPE); System.Func <StorageEngine> storageEngineSupplier = () => localDatabase.DataSource().DependencyResolver.resolveDependency(typeof(StorageEngine)); ReplicatedRelationshipTypeTokenHolder relationshipTypeTokenHolder = new ReplicatedRelationshipTypeTokenHolder(relationshipTypeTokenRegistry, replicator, this.IdGeneratorFactory, storageEngineSupplier); TokenRegistry propertyKeyTokenRegistry = new TokenRegistry(Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_PROPERTY_KEY); ReplicatedPropertyKeyTokenHolder propertyKeyTokenHolder = new ReplicatedPropertyKeyTokenHolder(propertyKeyTokenRegistry, replicator, this.IdGeneratorFactory, storageEngineSupplier); TokenRegistry labelTokenRegistry = new TokenRegistry(Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_LABEL); ReplicatedLabelTokenHolder labelTokenHolder = new ReplicatedLabelTokenHolder(labelTokenRegistry, replicator, this.IdGeneratorFactory, storageEngineSupplier); ReplicatedLockTokenStateMachine replicatedLockTokenStateMachine = new ReplicatedLockTokenStateMachine(lockTokenState); VersionContextSupplier versionContextSupplier = platformModule.VersionContextSupplier; ReplicatedTokenStateMachine labelTokenStateMachine = new ReplicatedTokenStateMachine(labelTokenRegistry, logProvider, versionContextSupplier); ReplicatedTokenStateMachine propertyKeyTokenStateMachine = new ReplicatedTokenStateMachine(propertyKeyTokenRegistry, logProvider, versionContextSupplier); ReplicatedTokenStateMachine relationshipTypeTokenStateMachine = new ReplicatedTokenStateMachine(relationshipTypeTokenRegistry, logProvider, versionContextSupplier); PageCursorTracerSupplier cursorTracerSupplier = platformModule.Tracers.pageCursorTracerSupplier; ReplicatedTransactionStateMachine replicatedTxStateMachine = new ReplicatedTransactionStateMachine(commandIndexTracker, replicatedLockTokenStateMachine, config.Get(state_machine_apply_max_batch_size), logProvider, cursorTracerSupplier, versionContextSupplier); dependencies.SatisfyDependencies(replicatedTxStateMachine); LocksFactory lockFactory = createLockFactory(config, logging); LocksSupplier = () => CreateLockManager(lockFactory, config, platformModule.Clock, replicator, myself, raftMachine, replicatedLockTokenStateMachine); RecoverConsensusLogIndex consensusLogIndexRecovery = new RecoverConsensusLogIndex(localDatabase, logProvider); CoreStateMachines = new CoreStateMachines(replicatedTxStateMachine, labelTokenStateMachine, relationshipTypeTokenStateMachine, propertyKeyTokenStateMachine, replicatedLockTokenStateMachine, idAllocationStateMachine, new DummyMachine(), localDatabase, consensusLogIndexRecovery); CommitProcessFactory = (appender, applier, ignored) => { localDatabase.RegisterCommitProcessDependencies(appender, applier); return(new ReplicatedTransactionCommitProcess(replicator)); }; this.TokenHolders = new TokenHolders(propertyKeyTokenHolder, labelTokenHolder, relationshipTypeTokenHolder); dependencies.SatisfyDependencies(TokenHolders); }
public BufferingIdGeneratorFactory(IdGeneratorFactory @delegate, IdReuseEligibility eligibleForReuse, IdTypeConfigurationProvider idTypeConfigurationProvider) { this.@delegate = @delegate; this._idTypeConfigurationProvider = idTypeConfigurationProvider; this._safeThreshold = snapshot => snapshot.allClosed() && eligibleForReuse.IsEligible(snapshot); }