예제 #1
0
        /// <summary>
        /// Construct a wrapper of supported backup strategies
        /// </summary>
        /// <param name="onlineBackupContext"> the input of the backup tool, such as CLI arguments, config etc. </param>
        /// <param name="backupProtocolService"> the underlying backup implementation for HA and single node instances </param>
        /// <param name="backupDelegator"> the backup implementation used for CC backups </param>
        /// <param name="pageCache"> the page cache used moving files </param>
        /// <returns> strategy coordinator that handles the which backup strategies are tried and establishes if a backup was successful or not </returns>
        internal virtual BackupStrategyCoordinator BackupStrategyCoordinator(OnlineBackupContext onlineBackupContext, BackupProtocolService backupProtocolService, BackupDelegator backupDelegator, PageCache pageCache)
        {
            FileSystemAbstraction  fs                     = _outsideWorld.fileSystem();
            BackupCopyService      copyService            = new BackupCopyService(fs, new FileMoveProvider(fs));
            ProgressMonitorFactory progressMonitorFactory = ProgressMonitorFactory.textual(_outsideWorld.errorStream());
            BackupRecoveryService  recoveryService        = new BackupRecoveryService();
            long   timeout = onlineBackupContext.RequiredArguments.Timeout;
            Config config  = onlineBackupContext.Config;

            StoreFiles     storeFiles = new StoreFiles(fs, pageCache);
            BackupStrategy ccStrategy = new CausalClusteringBackupStrategy(backupDelegator, _addressResolver, _logProvider, storeFiles);
            BackupStrategy haStrategy = new HaBackupStrategy(backupProtocolService, _addressResolver, _logProvider, timeout);

            BackupStrategyWrapper         ccStrategyWrapper       = Wrap(ccStrategy, copyService, pageCache, config, recoveryService);
            BackupStrategyWrapper         haStrategyWrapper       = Wrap(haStrategy, copyService, pageCache, config, recoveryService);
            StrategyResolverService       strategyResolverService = new StrategyResolverService(haStrategyWrapper, ccStrategyWrapper);
            IList <BackupStrategyWrapper> strategies = strategyResolverService.GetStrategies(onlineBackupContext.RequiredArguments.SelectedBackupProtocol);

            return(new BackupStrategyCoordinator(_consistencyCheckService, _outsideWorld, _logProvider, progressMonitorFactory, strategies));
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            HaBackupStrategy = mock(typeof(BackupStrategyWrapper));
            CcBackupStrategy = mock(typeof(BackupStrategyWrapper));
            Subject          = new StrategyResolverService(HaBackupStrategy, CcBackupStrategy);
        }