예제 #1
0
        /// <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;
        }
예제 #2
0
 /// <exception cref="System.IO.IOException"></exception>
 public DefragmentServicesImpl(DefragmentConfig defragConfig, IDefragmentListener
     listener)
 {
     _listener = listener;
     var originalConfig = (Config4Impl) defragConfig.Db4oConfig();
     var storage = defragConfig.BackupStorage();
     if (defragConfig.ReadOnly())
     {
         storage = new NonFlushingStorage(storage);
     }
     var 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;
 }