/// <exception cref="System.IO.IOException"></exception> public DefragmentServicesImpl(DefragmentConfig defragConfig, IDefragmentListener listener) { _listener = listener; Config4Impl originalConfig = (Config4Impl)defragConfig.Db4oConfig(); IStorage storage = defragConfig.BackupStorage(); if (defragConfig.ReadOnly()) { storage = new NonFlushingStorage(storage); } Config4Impl sourceConfig = PrepareConfig(originalConfig, storage, defragConfig.ReadOnly ()); _sourceDb = (LocalObjectContainer)Db4oFactory.OpenFile(sourceConfig, defragConfig .TempPath()).Ext(); _sourceDb.ShowInternalClasses(true); defragConfig.Db4oConfig().BlockSize(_sourceDb.BlockSize()); if (!originalConfig.GenerateCommitTimestamps().DefiniteNo()) { defragConfig.Db4oConfig().GenerateCommitTimestamps(_sourceDb.Config().GenerateCommitTimestamps ().DefiniteYes()); } _targetDb = FreshTargetFile(defragConfig); _mapping = defragConfig.Mapping(); _mapping.Open(); _defragConfig = defragConfig; }
private TransactionLogHandler NewTransactionLogHandler(LocalObjectContainer container ) { var fileBased = container.Config().FileBasedTransactionLog() && container is IoAdaptedObjectContainer; if (!fileBased) { return new EmbeddedTransactionLogHandler(container); } var fileName = ((IoAdaptedObjectContainer) container).FileName(); return new FileBasedTransactionLogHandler(container, fileName); }
public override void Convert(ConversionStage.SystemUpStage stage) { LocalObjectContainer container = stage.File(); if (!container.Config().GenerateCommitTimestamps().DefiniteYes()) { return; } container.ClassCollection().WriteAllClasses(); BuildCommitTimestampIndex(container); container.SystemTransaction().Commit(); }
private TransactionLogHandler NewTransactionLogHandler(LocalObjectContainer container ) { bool fileBased = container.Config().FileBasedTransactionLog() && container is IoAdaptedObjectContainer; if (!fileBased) { return(new EmbeddedTransactionLogHandler(container)); } string fileName = ((IoAdaptedObjectContainer)container).FileName(); return(new FileBasedTransactionLogHandler(container, fileName)); }