Ejemplo n.º 1
0
        private async Task <SymbolStatus> IndexSymbol(IStorageFeed feed, PackageName packageName, IBinaryInfo binaryInfo)
        {
            var symbolStatus = new SymbolStatus(new SymbolName(binaryInfo.Name, binaryInfo.SymbolInfo.Hash));

            try
            {
                Debug.WriteLine("Indexing symbol {0}", symbolStatus.SymbolName);
                await RequestOrSkip(string.Format("pdb/{0}", symbolStatus.SymbolName),
                                    async() =>
                {
                    Debug.WriteLine("Storing symbol {0}", symbolStatus.SymbolName);
                    var symbolItem = feed.GetSymbol(packageName, symbolStatus.SymbolName);

                    var pdbstrSection = CreatePdbStrSection(binaryInfo);
                    using (var inputStream = binaryInfo.SymbolInfo.File.GetStream())
                        using (var tempStream = new MemoryStream())
                            using (var outputStream = await symbolItem.Put())
                            {
                                pdbStoreManager.WriteSrcSrv(inputStream, tempStream, pdbstrSection);
                                tempStream.Position = 0;
                                var symbolFileName  = Path.GetFileName(binaryInfo.SymbolInfo.File.FullPath);
                                fileCompressor.Compress(symbolFileName, tempStream, outputStream);
                            }
                });

                symbolStatus.Stored = true;
                Debug.WriteLine("Stored symbol {0}", symbolStatus.SymbolName);
            }
            catch (Exception e)
            {
                support.TrackException(e, new { packageName });
                symbolStatus.Exception = new ExceptionStatus(e);
            }

            if (binaryInfo.SymbolInfo.SourceInfos != null)
            {
                symbolStatus.SourceStatuses = await ProcessThrottled(
                    5, binaryInfo.SymbolInfo.SourceInfos,
                    async s => await IndexSource(feed, packageName, s));
            }

            return(symbolStatus);
        }
Ejemplo n.º 2
0
        private async Task <SymbolStatus> DeleteSymbol(IStorageFeed feed, PackageName packageName, SymbolStatus symbolStatus)
        {
            var newSymbolStatus = new SymbolStatus(symbolStatus.SymbolName);

            if (symbolStatus.Stored)
            {
                try
                {
                    Debug.WriteLine("Deleting symbol {0}", symbolStatus.SymbolName);
                    newSymbolStatus.Stored = true;

                    await RequestOrSkip(string.Format("pdb/{0}", symbolStatus.SymbolName),
                                        async() =>
                    {
                        var symbolItem = feed.GetSymbol(packageName, symbolStatus.SymbolName);
                        await symbolItem.Delete();
                    });

                    newSymbolStatus.Stored = false;
                    Debug.WriteLine("Deleted symbol {0}", symbolStatus.SymbolName);
                }
                catch (Exception e)
                {
                    support.TrackException(e, new { packageName });
                    newSymbolStatus.Exception = new ExceptionStatus(e);
                }
            }

            if (symbolStatus.SourceStatuses != null)
            {
                newSymbolStatus.SourceStatuses = await ProcessThrottled(
                    5, symbolStatus.SourceStatuses,
                    async s => await DeleteSource(feed, packageName, s));
            }

            return(newSymbolStatus);
        }