namespace Producer.Features.CrawlerSupport; public abstract class BaseCrawler(ILogger logger, IDataStorage storage) : ICrawler { protected abstract IReadOnlyDictionary Mappings { get; } protected abstract string Url { get; } protected abstract string Source { get; } protected IDataStorage Storage => storage; public virtual Task Execute() => Task.CompletedTask; protected async Task InsertTorrents(IReadOnlyCollection torrent) { var result = await storage.InsertTorrents(torrent); if (!result.Success) { logger.LogWarning("Ingestion Failed: [{Error}]", result.ErrorMessage); return result; } logger.LogInformation("Ingestion Successful - Wrote {Count} new torrents", result.InsertedCount); return result; } }