public async Task <int> IndexWorkRootAsync( WorkRoot workRoot, Action <string>?onProgress = null, CancellationToken cancellationToken = default) { using IBoostDbContext dbContext = _dbContextFactory.Open(DbOpenMode.ReadWrite); IEnumerable <IConnectedService> connectedServices = await _connectedServiceManager .GetServicesAsync(cancellationToken); ClearIndex(workRoot.Name); int indexCount = 0; foreach (DirectoryInfo?dir in new DirectoryInfo(workRoot.Path) .GetDirectories()) { AddToIndex(workRoot, dir.FullName, connectedServices, dbContext); GitRepositoryIndex?repoIndex = Index(dir.FullName); onProgress?.Invoke(dir.FullName); indexCount++; } return(indexCount); }
public async Task <IEnumerable <ConnectedService> > GetConnectedServices( [Service] IConnectedServiceManager serviceManager, CancellationToken cancellationToken) { IEnumerable <IConnectedService> services = await serviceManager.GetServicesAsync(cancellationToken); return(services.Select(x => new ConnectedService { Id = x.Id, Name = x.Name, Type = x.Type, })); }
protected override async Task <IReadOnlyDictionary <Guid, ConnectedService> > LoadBatchAsync( IReadOnlyList <Guid> keys, CancellationToken cancellationToken) { IEnumerable <IConnectedService> services = await _connectedServiceManager .GetServicesAsync(cancellationToken); return(services.Select(x => new ConnectedService { Id = x.Id, Name = x.Name, Type = x.Type, }).ToDictionary(x => x.Id)); }