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(); }
async public Task Connect(GitLabInstance gitLabInstance, DataCacheConnectionContext context) { reset(); string hostname = gitLabInstance.HostName; IHostProperties hostProperties = gitLabInstance.HostProperties; _operator = new DataCacheOperator(hostname, hostProperties); try { InternalCacheUpdater cacheUpdater = new InternalCacheUpdater(new InternalCache()); IMergeRequestListLoader mergeRequestListLoader = MergeRequestListLoaderFactory.CreateMergeRequestListLoader(hostname, _operator, context, cacheUpdater); Trace.TraceInformation(String.Format("[DataCache] Starting new dataCache at {0}", hostname)); User currentUser = await new CurrentUserLoader(_operator).Load(hostname); await mergeRequestListLoader.Load(); _internal = createCacheInternal(cacheUpdater, hostname, hostProperties, currentUser, context); Trace.TraceInformation(String.Format("[DataCache] Started new dataCache at {0}", hostname)); Connected?.Invoke(hostname, currentUser); } catch (BaseLoaderException ex) { if (ex is BaseLoaderCancelledException) { throw new DataCacheConnectionCancelledException(); } throw new DataCacheException(ex.OriginalMessage, ex); } }
public ProjectBasedProjectListLoader(DataCacheOperator op, InternalCacheUpdater cacheUpdater, DataCacheConnectionContext dataCacheConnectionContext) : base(op) { _cacheUpdater = cacheUpdater; _dataCacheConnectionContext = dataCacheConnectionContext; Debug.Assert(_dataCacheConnectionContext.CustomData is ProjectBasedContext); }
internal SearchBasedProjectListLoader(string hostname, DataCacheOperator op, InternalCacheUpdater cacheUpdater, DataCacheConnectionContext dataCacheConnectionContext) : base(op) { _hostname = hostname; _cacheUpdater = cacheUpdater; _dataCacheConnectionContext = dataCacheConnectionContext; Debug.Assert(_dataCacheConnectionContext.CustomData is SearchBasedContext); }
internal MergeRequestLoader(DataCacheOperator op, InternalCacheUpdater cacheUpdater, bool updateOnlyOpened, bool isApprovalStatusSupported) : base(op) { _cacheUpdater = cacheUpdater; _versionLoader = new VersionLoader(op, cacheUpdater); _approvalLoader = isApprovalStatusSupported ? new ApprovalLoader(op, cacheUpdater) : null; _updateOnlyOpened = updateOnlyOpened; }
internal MergeRequestListLoader(string hostname, DataCacheOperator op, InternalCacheUpdater cacheUpdater, DataCacheCallbacks callbacks, SearchQueryCollection queryCollection, bool isApprovalStatusSupported) : base(op) { _hostname = hostname; _cacheUpdater = cacheUpdater; _versionLoader = new VersionLoader(_operator, cacheUpdater); _approvalLoader = isApprovalStatusSupported ? new ApprovalLoader(_operator, cacheUpdater) : null; _callbacks = callbacks; _queryCollection = queryCollection; }
async public Task Connect(GitLabInstance gitLabInstance, DataCacheConnectionContext connectionContext) { assertNotConnected(); string hostname = gitLabInstance.HostName; IHostProperties hostProperties = gitLabInstance.HostProperties; _operator = new DataCacheOperator(hostname, hostProperties, gitLabInstance.NetworkOperationStatusListener); DataCacheOperator myOperator = _operator; _isConnecting = true; try { Connecting?.Invoke(hostname); InternalCacheUpdater cacheUpdater = new InternalCacheUpdater(new InternalCache()); bool isApprovalStatusSupported = await gitLabInstance.IsApprovalStatusSupported(); IMergeRequestListLoader mergeRequestListLoader = new MergeRequestListLoader( hostname, _operator, cacheUpdater, _cacheContext.Callbacks, connectionContext.QueryCollection, isApprovalStatusSupported); traceInformation(String.Format("Connecting data cache to {0}...", hostname)); string accessToken = hostProperties.GetAccessToken(hostname); await new CurrentUserLoader(_operator).Load(hostname, accessToken); User currentUser = GlobalCache.GetAuthenticatedUser(hostname, accessToken); await mergeRequestListLoader.Load(); _internal = createCacheInternal(cacheUpdater, hostname, hostProperties, currentUser, connectionContext.QueryCollection, gitLabInstance.ModificationNotifier, gitLabInstance.NetworkOperationStatusListener, isApprovalStatusSupported); ConnectionContext = connectionContext; traceInformation(String.Format("Data cache connected to {0}", hostname)); Connected?.Invoke(hostname, currentUser); } catch (BaseLoaderException ex) { reset(); if (ex is BaseLoaderCancelledException) { throw new DataCacheConnectionCancelledException(); } throw new DataCacheException(ex.OriginalMessage, ex); } finally { _isConnecting = false; } }
internal static IProjectListLoader CreateProjectListLoader(string hostname, DataCacheOperator op, DataCacheConnectionContext context, InternalCacheUpdater cache) { IProjectListLoader listLoader = null; if (context.CustomData is ProjectBasedContext) { listLoader = new ProjectBasedProjectListLoader(op, cache, context); } else if (context.CustomData is SearchBasedContext) { listLoader = new SearchBasedProjectListLoader(hostname, op, cache, context); } return(listLoader); }
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 ProjectListLoader(string hostname, DataCacheOperator op) : base(op) { _hostname = hostname; }
internal ApprovalLoader(DataCacheOperator op, InternalCacheUpdater cacheUpdater) : base(op) { _cacheUpdater = cacheUpdater; }
public UserListLoader(string hostname, DataCacheOperator op) : base(op) { _hostname = hostname; }
internal BaseDataCacheLoader(DataCacheOperator op) { _operator = op; }
internal VersionLoader(DataCacheOperator op, InternalCacheUpdater cacheUpdater) : base(op) { _cacheUpdater = cacheUpdater; }
internal CurrentUserLoader(DataCacheOperator op) : base(op) { }
internal MergeRequestLoader(DataCacheOperator op, InternalCacheUpdater cacheUpdater) : base(op) { _cacheUpdater = cacheUpdater; _versionLoader = new VersionLoader(op, cacheUpdater); }