private GraphDatabaseAPI DatabaseWithManyPropertyKeys(int propertyKeyCount) { PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get()); StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fileSystemRule.get()), pageCache, _fileSystemRule.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); NeoStores neoStores = storeFactory.OpenAllNeoStores(true); PropertyKeyTokenStore store = neoStores.PropertyKeyTokenStore; for (int i = 0; i < propertyKeyCount; i++) { PropertyKeyTokenRecord record = new PropertyKeyTokenRecord(( int )store.nextId()); record.InUse = true; ICollection <DynamicRecord> nameRecords = store.AllocateNameRecords(PropertyStore.encodeString(Key(i))); record.AddNameRecords(nameRecords); record.NameId = ( int )Iterables.first(nameRecords).Id; store.UpdateRecord(record); } neoStores.Close(); return(Database()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.causalclustering.core.state.snapshot.CoreSnapshot bootstrap(java.util.Set<org.neo4j.causalclustering.identity.MemberId> members) throws Exception public virtual CoreSnapshot Bootstrap(ISet <MemberId> members) { if (_recoveryRequiredChecker.isRecoveryRequiredAt(_databaseLayout)) { string message = "Cannot bootstrap. Recovery is required. Please ensure that the store being seeded comes from a cleanly shutdown " + "instance of Neo4j or a Neo4j backup"; _log.error(message); throw new System.InvalidOperationException(message); } StoreFactory factory = new StoreFactory(_databaseLayout, _config, new DefaultIdGeneratorFactory(_fs), _pageCache, _fs, _logProvider, EmptyVersionContextSupplier.EMPTY); NeoStores neoStores = factory.OpenAllNeoStores(true); neoStores.Close(); CoreSnapshot coreSnapshot = new CoreSnapshot(FIRST_INDEX, FIRST_TERM); coreSnapshot.Add(CoreStateType.ID_ALLOCATION, DeriveIdAllocationState(_databaseLayout)); coreSnapshot.Add(CoreStateType.LOCK_TOKEN, new ReplicatedLockTokenState()); coreSnapshot.Add(CoreStateType.RAFT_CORE_STATE, new RaftCoreState(new MembershipEntry(FIRST_INDEX, members))); coreSnapshot.Add(CoreStateType.SESSION_TRACKER, new GlobalSessionTrackerState()); AppendNullTransactionLogEntryToSetRaftIndexToMinusOne(); return(coreSnapshot); }