private void MigrateFreespace(IFreespaceManager oldFreespaceManager) { IFreespaceManager newFreespaceManager = AbstractFreespaceManager.CreateNew(this, ConfigImpl.FreespaceSystem()); newFreespaceManager.Start(0); SystemData().FreespaceSystem(ConfigImpl.FreespaceSystem()); InstallFreespaceManager(newFreespaceManager); AbstractFreespaceManager.Migrate(oldFreespaceManager, newFreespaceManager); _fileHeader.WriteVariablePart(this); }
/// <exception cref="Db4objects.Db4o.Ext.OldFormatException"></exception> internal virtual void ReadThis() { NewSystemData(AbstractFreespaceManager.FmLegacyRam, StandardIdSystemFactory.Legacy ); BlockSizeReadFromFile(1); _fileHeader = FileHeader.Read(this); if (Config().GenerateCommitTimestamps().IsUnspecified()) { Config().GenerateCommitTimestamps(_systemData.IdToTimestampIndexId() != 0); } CreateStringIO(_systemData.StringEncoding()); CreateIdSystem(); InitializeClassMetadataRepository(); InitalizeWeakReferenceSupport(); SetNextTimeStampId(SystemData().LastTimeStampID()); ClassCollection().SetID(_systemData.ClassCollectionID()); ClassCollection().Read(SystemTransaction()); Converter.Convert(new ConversionStage.ClassCollectionAvailableStage(this)); _fileHeader.ReadIdentity(this); if (_config.IsReadOnly()) { return; } if (!ConfigImpl.CommitRecoveryDisabled()) { _fileHeader.CompleteInterruptedTransaction(this); } IFreespaceManager blockedFreespaceManager = AbstractFreespaceManager.CreateNew(this , _systemData.FreespaceSystem()); InstallFreespaceManager(blockedFreespaceManager); blockedFreespaceManager.Read(this, _systemData.InMemoryFreespaceSlot()); blockedFreespaceManager.Start(_systemData.BTreeFreespaceId()); _fileHeader = _fileHeader.Convert(this); if (FreespaceMigrationRequired(blockedFreespaceManager)) { MigrateFreespace(blockedFreespaceManager); } WriteHeader(true, false); if (Converter.Convert(new ConversionStage.SystemUpStage(this))) { _systemData.ConverterVersion(Converter.Version); _fileHeader.WriteVariablePart(this); Transaction.Commit(); } }