internal MergeRequestManager( DataCacheContext dataCacheContext, InternalCacheUpdater cacheUpdater, string hostname, IHostProperties hostProperties, DataCacheConnectionContext context, IModificationNotifier modificationNotifier) { _dataCacheContext = dataCacheContext; _cacheUpdater = cacheUpdater; _modificationNotifier = modificationNotifier; _modificationNotifier.MergeRequestModified += onMergeRequestModified; if (context.UpdateRules.UpdateMergeRequestsPeriod.HasValue) { DataCacheConnectionContext updateContext = new DataCacheConnectionContext( new DataCacheCallbacks(null, null), // disable callbacks from updates context.UpdateRules, context.CustomData); _updateManager = new UpdateManager(_dataCacheContext, hostname, hostProperties, updateContext, _cacheUpdater); _updateManager.MergeRequestEvent += onUpdate; } }
internal UpdateManager( DataCacheContext dataCacheContext, string hostname, IHostProperties hostProperties, SearchQueryCollection queryCollection, InternalCacheUpdater cacheUpdater, INetworkOperationStatusListener networkOperationStatusListener, bool isApprovalStatusSupported) { _updateOperator = new DataCacheOperator(hostname, hostProperties, networkOperationStatusListener); _mergeRequestListLoader = new MergeRequestListLoader( hostname, _updateOperator, cacheUpdater, null, queryCollection, isApprovalStatusSupported); _mergeRequestLoader = new MergeRequestLoader(_updateOperator, cacheUpdater, dataCacheContext.UpdateRules.UpdateOnlyOpenedMergeRequests, isApprovalStatusSupported); _extLogging = dataCacheContext.UpdateManagerExtendedLogging; _tagForLogging = dataCacheContext.TagForLogging; _cache = cacheUpdater.Cache; _timer = new System.Timers.Timer { Interval = dataCacheContext.UpdateRules.UpdateMergeRequestsPeriod.Value }; _timer.Elapsed += onTimer; _timer.SynchronizingObject = dataCacheContext.SynchronizeInvoke; _timer.Start(); }
private void createLiveDataCacheAndDependencies() { // The idea is that: // 1. Already cached MR that became closed remotely will not be removed from the cache // 2. Open MR that are missing in the cache, will be added to the cache // 3. Open MR that exist in the cache, will be updated // 4. Non-cached MR that are closed remotely, will not be added to the cache even if directly requested by IId bool updateOnlyOpened = true; DataCacheContext dataCacheContext = new DataCacheContext(this, _mergeRequestFilter, _keywords, Program.Settings.UpdateManagerExtendedLogging, "Live", new DataCacheCallbacks(onForbiddenProject, onNotFoundProject), new DataCacheUpdateRules(Program.Settings.AutoUpdatePeriodMs, Program.Settings.AutoUpdatePeriodMs, updateOnlyOpened), true, true); _liveDataCache = new DataCache(dataCacheContext); getListView(EDataCacheType.Live).SetDataCache(_liveDataCache); getListView(EDataCacheType.Live).SetFilter(_mergeRequestFilter); DataCache dataCache = getDataCache(EDataCacheType.Live); _expressionResolver = new ExpressionResolver(dataCache); selectColorScheme(); // requires ExpressionResolver _eventFilter = new EventFilter(Program.Settings, dataCache, _mergeRequestFilter); _userNotifier = new UserNotifier(dataCache, _eventFilter, _trayIcon); }
private void createLiveDataCacheAndDependencies() { DataCacheContext dataCacheContext = new DataCacheContext(this, _mergeRequestFilter, _keywords); _liveDataCache = new DataCache(dataCacheContext, _modificationNotifier); _expressionResolver = new ExpressionResolver(_liveDataCache); _eventFilter = new EventFilter(Program.Settings, _liveDataCache, _mergeRequestFilter); _userNotifier = new UserNotifier(_liveDataCache, _eventFilter, _trayIcon); }
private void createRecentDataCache() { DataCacheContext dataCacheContext = new DataCacheContext(this, _mergeRequestFilter, _keywords, Program.Settings.UpdateManagerExtendedLogging, "Recent", new DataCacheCallbacks(null, null), getDataCacheUpdateRules(EDataCacheType.Recent), false, false); _recentDataCache = new DataCache(dataCacheContext); getListView(EDataCacheType.Recent).SetDataCache(_recentDataCache); }
internal MergeRequestManager( DataCacheContext dataCacheContext, InternalCacheUpdater cacheUpdater, string hostname, IHostProperties hostProperties, SearchQueryCollection queryCollection, INetworkOperationStatusListener networkOperationStatusListener, bool isApprovalStatusSupported) { _cacheUpdater = cacheUpdater; _listRefreshTimestamp = DateTime.Now; if (dataCacheContext.UpdateRules.UpdateMergeRequestsPeriod.HasValue) { _updateManager = new UpdateManager(dataCacheContext, hostname, hostProperties, queryCollection, _cacheUpdater, networkOperationStatusListener, isApprovalStatusSupported); _updateManager.MergeRequestEvent += onUpdate; _updateManager.MergeRequestListRefreshed += onListRefreshed; _updateManager.MergeRequestRefreshed += onMergeRequestRefreshed; } }
internal DiscussionManager( DataCacheContext dataCacheContext, string hostname, IHostProperties hostProperties, User user, IMergeRequestCache mergeRequestCache, IModificationNotifier modificationNotifier, INetworkOperationStatusListener networkOperationStatusListener) { _operator = new DiscussionOperator(hostname, hostProperties, networkOperationStatusListener); _parser = new DiscussionParser(this, dataCacheContext.DiscussionKeywords, user); _parser.DiscussionEvent += onDiscussionParserEvent; _mergeRequestFilterChecker = dataCacheContext.MergeRequestFilterChecker; _tagForLogging = dataCacheContext.TagForLogging; _mergeRequestCache = mergeRequestCache; _mergeRequestCache.MergeRequestEvent += OnMergeRequestEvent; _modificationNotifier = modificationNotifier; _modificationNotifier.DiscussionResolved += onDiscussionResolved; _modificationNotifier.DiscussionModified += onDiscussionModified; if (dataCacheContext.UpdateRules.UpdateDiscussionsPeriod.HasValue) { _timer = new System.Timers.Timer { Interval = dataCacheContext.UpdateRules.UpdateDiscussionsPeriod.Value }; _timer.Elapsed += onTimer; _timer.SynchronizingObject = dataCacheContext.SynchronizeInvoke; _timer.Start(); scheduleUpdate(null /* update all merge requests cached at the moment of update processing */, DiscussionUpdateType.InitialSnapshot); } }
internal UserCache(IUserListLoader userListLoader, DataCacheContext context, string hostname) { _userListLoader = userListLoader; _context = context; _hostname = hostname; _context.SynchronizeInvoke.BeginInvoke(new Action( async() => { try { await _userListLoader.Load(); } catch (BaseLoaderException ex) { if (ex is BaseLoaderCancelledException) { return; } ExceptionHandlers.Handle("Cannot load list of users", ex); } }), null); }
internal UpdateManager( DataCacheContext dataCacheContext, string hostname, IHostProperties hostProperties, DataCacheConnectionContext context, InternalCacheUpdater cacheUpdater) { DataCacheOperator updateOperator = new DataCacheOperator(hostname, hostProperties); _mergeRequestListLoader = MergeRequestListLoaderFactory.CreateMergeRequestListLoader( hostname, updateOperator, context, cacheUpdater); _mergeRequestLoader = new MergeRequestLoader(updateOperator, cacheUpdater); _cache = cacheUpdater.Cache; _timer = new System.Timers.Timer { Interval = context.UpdateRules.UpdateMergeRequestsPeriod.Value }; _timer.Elapsed += onTimer; _timer.SynchronizingObject = dataCacheContext.SynchronizeInvoke; _timer.Start(); }
internal ProjectCache(InternalCacheUpdater cacheUpdater, IProjectListLoader projectListLoader, DataCacheContext context) { _cacheUpdater = cacheUpdater; _projectListLoader = projectListLoader; _context = context; _context.SynchronizeInvoke.BeginInvoke(new Action( async() => { try { await _projectListLoader.Load(); } catch (BaseLoaderException ex) { if (ex is BaseLoaderCancelledException) { return; } ExceptionHandlers.Handle("Cannot load list of projects", ex); } }), null); }
private void createSearchDataCache() { DataCacheContext dataCacheContext = new DataCacheContext(this, _mergeRequestFilter, _keywords); _searchDataCache = new DataCache(dataCacheContext, _modificationNotifier); }