Example #1
0
        public AnalysisStorage(ITaskScheduler taskScheduler,
                               IFilesystem filesystem,
                               ILogAnalyserEngine logAnalyserEngine,
                               ITypeFactory typeFactory = null)
        {
            if (taskScheduler == null)
            {
                throw new ArgumentNullException(nameof(taskScheduler));
            }
            if (filesystem == null)
            {
                throw new ArgumentNullException(nameof(filesystem));
            }
            if (logAnalyserEngine == null)
            {
                throw new ArgumentNullException(nameof(logAnalyserEngine));
            }

            _taskScheduler     = taskScheduler;
            _logAnalyserEngine = logAnalyserEngine;
            _filesystem        = filesystem;
            _syncRoot          = new object();

            _snapshots         = new SnapshotsWatchdog(taskScheduler, filesystem, typeFactory);
            _templates         = new List <ActiveAnalysisConfiguration>();
            _analyses          = new Dictionary <AnalysisId, ActiveAnalysis>();
            _lastSavedAnalyses = new Dictionary <AnalysisId, ActiveAnalysisConfiguration>();
        }
        public AnalysisStorage(ITaskScheduler taskScheduler,
                               IFilesystem filesystem,
                               IDataSourceAnalyserEngine dataSourceAnalyserEngine,
                               ITypeFactory typeFactory)
        {
            _taskScheduler            = taskScheduler ?? throw new ArgumentNullException(nameof(taskScheduler));
            _dataSourceAnalyserEngine = dataSourceAnalyserEngine ?? throw new ArgumentNullException(nameof(dataSourceAnalyserEngine));
            _filesystem  = filesystem ?? throw new ArgumentNullException(nameof(filesystem));
            _typeFactory = typeFactory ?? throw new ArgumentNullException(nameof(typeFactory));
            _syncRoot    = new object();

            _snapshots         = new SnapshotsWatchdog(taskScheduler, filesystem, typeFactory);
            _templates         = new List <ActiveAnalysisConfiguration>();
            _analyses          = new Dictionary <AnalysisId, ActiveAnalysis>();
            _lastSavedAnalyses = new Dictionary <AnalysisId, ActiveAnalysisConfiguration>();

            // TODO: Maybe don't block in the ctor in the future?
            // If we do that, the public interface will have to be changed
            RestoreSavedAnalysesAsync().Wait();
        }