private IList <(Checksum, object)> ReadAssets( Stream stream, int scopeId, ISet <Checksum> checksums, CancellationToken cancellationToken) { var results = new List <(Checksum, object)>(); using (var reader = ObjectReader.TryGetReader(stream, cancellationToken)) { Debug.Assert(reader != null, @"We only ge a reader for data transmitted between live processes. This data should always be correct as we're never persisting the data between sessions."); var responseScopeId = reader.ReadInt32(); Contract.ThrowIfFalse(scopeId == responseScopeId); var count = reader.ReadInt32(); Contract.ThrowIfFalse(count == checksums.Count); for (var i = 0; i < count; i++) { var responseChecksum = Checksum.ReadFrom(reader); Contract.ThrowIfFalse(checksums.Contains(responseChecksum)); var kind = (WellKnownSynchronizationKind)reader.ReadInt32(); // in service hub, cancellation means simply closed stream var @object = AssetService.Deserialize <object>(kind, reader, cancellationToken); results.Add((responseChecksum, @object)); } return(results); } }
public SolutionCreator(AssetService assetService, Solution baseSolution, CancellationToken cancellationToken) { Contract.ThrowIfNull(baseSolution); _assetService = assetService; _baseSolution = baseSolution; _cancellationToken = cancellationToken; }
public RoslynServices(int scopeId, AssetStorage storage, HostServices hostServices) { _scopeId = scopeId; AssetService = new AssetService(_scopeId, storage, SolutionService.PrimaryWorkspace); SolutionService = new SolutionService(AssetService); CompilationService = new CompilationService(SolutionService); }
public RoslynServices(int scopeId, AssetStorage storage) { _scopeId = scopeId; AssetService = new AssetService(_scopeId, storage); SolutionService = new SolutionService(AssetService); CompilationService = new CompilationService(SolutionService); }
public RoslynServices(int scopeId, AssetStorage storage, HostServices hostServices) { _scopeId = scopeId; var mefHostExportProvider = (IMefHostExportProvider)hostServices; var primaryWorkspace = mefHostExportProvider.GetExports <PrimaryWorkspace>().Single().Value; var workspace = (RemoteWorkspace)primaryWorkspace.Workspace ?? new RemoteWorkspace(); AssetService = new AssetService(_scopeId, storage, workspace); SolutionService = new SolutionService(AssetService); CompilationService = new CompilationService(SolutionService); }
public SolutionService(AssetService assetService) { _assetService = assetService; }
public ChecksumSynchronizer(AssetService assetService) { _assetService = assetService; }
private async Task <Dictionary <ProjectId, ProjectStateChecksums> > GetProjectMapAsync(AssetService assetService, HashSet <Checksum> projects) { var map = new Dictionary <ProjectId, ProjectStateChecksums>(); var projectChecksums = await assetService.GetAssetsAsync <ProjectStateChecksums>(projects, _cancellationToken).ConfigureAwait(false); var infos = await assetService.GetAssetsAsync <ProjectInfo.ProjectAttributes>(projectChecksums.Select(p => p.Item2.Info), _cancellationToken).ConfigureAwait(false); foreach (var kv in projectChecksums) { var info = await assetService.GetAssetAsync <ProjectInfo.ProjectAttributes>(kv.Item2.Info, _cancellationToken).ConfigureAwait(false); map.Add(info.Id, kv.Item2); } return(map); }
private async Task <Dictionary <DocumentId, DocumentStateChecksums> > GetDocumentMapAsync(AssetService assetService, HashSet <Checksum> documents) { var map = new Dictionary <DocumentId, DocumentStateChecksums>(); var documentChecksums = await assetService.GetAssetsAsync <DocumentStateChecksums>(documents, _cancellationToken).ConfigureAwait(false); foreach (var kv in documentChecksums) { var info = await assetService.GetAssetAsync <DocumentInfo.DocumentAttributes>(kv.Item2.Info, _cancellationToken).ConfigureAwait(false); map.Add(info.Id, kv.Item2); } return(map); }
public SolutionCreator(AssetService assetService, Solution baseSolution, CancellationToken cancellationToken) { _assetService = assetService; _baseSolution = baseSolution; _cancellationToken = cancellationToken; }