private async Task BackupTableAsync(IAzureTableBackup table) { await _loggingRepository.LogMessageAsync(new LogMessage { Message = $"Starting backup maintenance for table: {table.SourceTableName}" }); var entities = await _azureTableBackupRepository.GetEntitiesAsync(table); if (entities == null) { return; } // basically, the table storage gets used regardless, to read the source table // and to maintain the tracking table. this determines whether the backup data // is stored in table or blob storage. IAzureStorageBackupRepository backUpTo = DetermineBackupStorage(table.BackupType); if (backUpTo == null) { await _loggingRepository.LogMessageAsync(new LogMessage { Message = $"BackupType must be 'table' or 'blob'. Was {table.BackupType}. Not backing up {table.SourceTableName}." }); return; } await _loggingRepository.LogMessageAsync(new LogMessage { Message = $"Backing up {entities.Count} entites from table {table.SourceTableName} to {table.BackupType} storage." }); var backupResult = await backUpTo.BackupEntitiesAsync(table, entities); await CompareBackupResults(table, backupResult); }
public AzureTableBackupService( List <AzureTableBackup> tablesToBackup, ILoggingRepository loggingRepository, IAzureTableBackupRepository azureTableBackupRepository, IAzureStorageBackupRepository azureBlobBackupRepository) { _tablesToBackup = tablesToBackup; _loggingRepository = loggingRepository ?? throw new ArgumentNullException(nameof(loggingRepository)); _azureTableBackupRepository = azureTableBackupRepository ?? throw new ArgumentNullException(nameof(azureTableBackupRepository)); _azureBlobBackupRepository = azureBlobBackupRepository ?? throw new ArgumentNullException(nameof(azureBlobBackupRepository)); }