public StorageManager(IStorageContext storage, IWebHostConfiguration configuration, IWebScheduler scheduler) { this.scheduler = scheduler; this.interval = AdvConvert.ConvertToTimeSpan(configuration.Storage.Interval); foreach (StorageAreaElement areaConfig in configuration.Storage.Items) { IStorageAreaConfigurator areaConfigurator = storage.Configure.Area(areaConfig.Name); if (!areaConfig.History) { continue; } areaConfigurator.EnableHistory(); if (string.IsNullOrEmpty(areaConfig.HistoryAge)) { continue; } TimeSpan historyAge = AdvConvert.ConvertToTimeSpan(areaConfig.HistoryAge); if (historyAge <= TimeSpan.Zero) { continue; } cleaners.Add(areaConfig.Name, new StorageHistoryCleaner( new Lazy <IStorageAreaHistory>(() => storage.Area(areaConfig.Name).History), historyAge)); } }
//TODO: To many dependencies, refactor! public StorageIndexManager(IStorageIndex index, IStorageContext storage, IWebHostConfiguration configuration, IWebScheduler scheduler, IInitializationTracker tracker, IDiagnosticsLogger logger) { this.index = index; this.debugging = configuration.Index.Debugging; if (this.debugging) { this.index.Writer.InfoEvent += (sender, args) => logger.Log("indexdebug", Severity.Critical, args.Message, new { args }); } this.scheduler = scheduler; this.tracker = tracker; this.logger = logger; interval = TimeSpan.FromSeconds(configuration.Index.Watch.Interval); if (!string.IsNullOrEmpty(configuration.Index.Watch.RamBuffer)) { buffer = (int)AdvConvert.ConvertToByteCount(configuration.Index.Watch.RamBuffer) / (1024 * 1024); } watchers = configuration.Index.Watch.Items .ToDictionary(we => we.Area, we => (IStorageIndexChangeLogWatcher) new StorageChangeLogWatcher(we.Area, storage.Area(we.Area).Log, we.BatchSize < 1 ? configuration.Index.Watch.BatchSize : we.BatchSize, logger, InfoStream)); }
public LoggerFactory(IWebHostConfiguration configuration, IPathResolver resolver, IPerformanceLoggingCustomDataProviderManager customDataProviderManager) { this.configuration = configuration; this.resolver = resolver; this.customDataProviderManager = customDataProviderManager; }