internal Applier(GraphStoreFixture outerInstance) { this._outerInstance = outerInstance; Database = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(outerInstance.directory.DatabaseDir()).setConfig("dbms.backup.enabled", "false").newGraphDatabase(); DependencyResolver dependencyResolver = Database.DependencyResolver; CommitProcess = new TransactionRepresentationCommitProcess(dependencyResolver.ResolveDependency(typeof(TransactionAppender)), dependencyResolver.ResolveDependency(typeof(StorageEngine))); TransactionIdStore = Database.DependencyResolver.resolveDependency(typeof(TransactionIdStore)); NeoStores = Database.DependencyResolver.resolveDependency(typeof(RecordStorageEngine)).testAccessNeoStores(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private long applyTransactions(java.io.File fromPath, org.neo4j.kernel.internal.GraphDatabaseAPI toDb, org.neo4j.kernel.configuration.Config toConfig, long fromTxExclusive, long toTxInclusive, java.io.PrintStream out) throws Exception private long ApplyTransactions( File fromPath, GraphDatabaseAPI toDb, Config toConfig, long fromTxExclusive, long toTxInclusive, PrintStream @out ) { DependencyResolver resolver = toDb.DependencyResolver; TransactionRepresentationCommitProcess commitProcess = new TransactionRepresentationCommitProcess( resolver.ResolveDependency( typeof( TransactionAppender ) ), resolver.ResolveDependency( typeof( StorageEngine ) ) ); LifeSupport life = new LifeSupport(); try { using ( DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), JobScheduler jobScheduler = createInitialisedScheduler(), PageCache pageCache = StandalonePageCacheFactory.createPageCache(fileSystem, jobScheduler) ) { LogicalTransactionStore source = life.Add( new ReadOnlyTransactionStore( pageCache, fileSystem, DatabaseLayout.of( fromPath ), Config.defaults(), new Monitors() ) ); life.Start(); long lastAppliedTx = fromTxExclusive; // Some progress if there are more than a couple of transactions to apply ProgressListener progress = toTxInclusive - fromTxExclusive >= 100 ? textual( @out ).singlePart( "Application progress", toTxInclusive - fromTxExclusive ) : Org.Neo4j.Helpers.progress.ProgressListener_Fields.None; using ( IOCursor<CommittedTransactionRepresentation> cursor = source.GetTransactions( fromTxExclusive + 1 ) ) { while ( cursor.next() ) { CommittedTransactionRepresentation transaction = cursor.get(); TransactionRepresentation transactionRepresentation = transaction.TransactionRepresentation; try { commitProcess.Commit( new TransactionToApply( transactionRepresentation ), NULL, EXTERNAL ); progress.Add( 1 ); } //JAVA TO C# CONVERTER WARNING: 'final' catch parameters are not available in C#: //ORIGINAL LINE: catch (final Throwable e) catch ( Exception e ) { Console.Error.WriteLine( "ERROR applying transaction " + transaction.CommitEntry.TxId ); throw e; } lastAppliedTx = transaction.CommitEntry.TxId; if ( lastAppliedTx == toTxInclusive ) { break; } } } return lastAppliedTx; } } finally { life.Shutdown(); } }