internal BackupStrategyWrapper(BackupStrategy backupStrategy, BackupCopyService backupCopyService, PageCache pageCache, Config config, BackupRecoveryService backupRecoveryService, LogProvider logProvider) { this._backupStrategy = backupStrategy; this._backupCopyService = backupCopyService; this._pageCache = pageCache; this._config = config; this._backupRecoveryService = backupRecoveryService; this._log = logProvider.GetLog(typeof(BackupStrategyWrapper)); }
/// <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)); }
private BackupStrategyWrapper Wrap(BackupStrategy strategy, BackupCopyService copyService, PageCache pageCache, Config config, BackupRecoveryService recoveryService) { return(new BackupStrategyWrapper(strategy, copyService, pageCache, config, recoveryService, _logProvider)); }