public async ValueTask <PackageDeprecationMetadataContextInfo?> GetDeprecationMetadataAsync( PackageIdentity identity, IReadOnlyCollection <PackageSourceContextInfo> packageSources, bool includePrerelease, CancellationToken cancellationToken) { Assumes.NotNull(identity); Assumes.NotNullOrEmpty(packageSources); string cacheId = PackageSearchMetadataCacheItem.GetCacheId(identity.Id, includePrerelease, packageSources); PackageSearchMetadataCacheItem?backgroundDataCache = PackageSearchMetadataMemoryCache.Get(cacheId) as PackageSearchMetadataCacheItem; if (backgroundDataCache != null) { PackageSearchMetadataCacheItemEntry cacheItem = await backgroundDataCache.GetPackageSearchMetadataCacheVersionedItemAsync(identity, cancellationToken); return(await cacheItem.PackageDeprecationMetadataContextInfo); } IPackageMetadataProvider packageMetadataProvider = await GetPackageMetadataProviderAsync(packageSources, cancellationToken); IPackageSearchMetadata packageMetadata = await packageMetadataProvider.GetPackageMetadataAsync(identity, includePrerelease, cancellationToken); PackageDeprecationMetadata deprecationMetadata = await packageMetadata.GetDeprecationMetadataAsync(); if (deprecationMetadata == null) { return(null); } return(PackageDeprecationMetadataContextInfo.Create(deprecationMetadata)); }
private async ValueTask <PackageDeprecationMetadataContextInfo?> GetPackageDeprecationMetadataContextInfoAsync() { PackageDeprecationMetadata?deprecationMetadata = await _packageSearchMetadata.GetDeprecationMetadataAsync(); if (deprecationMetadata == null) { return(null); } return(NuGet.VisualStudio.Internal.Contracts.PackageDeprecationMetadataContextInfo.Create(deprecationMetadata)); }
private async ValueTask <PackageDeprecationMetadataContextInfo?> GetPackageDeprecationMetadataContextInfoAsync() { // If PackageSearchMetadata was added to the cache directly from search then deprecation data could be null even if it exists, we need // to check the package metadata provider to be certain PackageDeprecationMetadata?deprecationMetadata = await _packageSearchMetadata.GetDeprecationMetadataAsync(); if (deprecationMetadata == null) { IPackageSearchMetadata detailedMetadata = await _detailedPackageSearchMetadata.Value; deprecationMetadata = await detailedMetadata.GetDeprecationMetadataAsync(); if (deprecationMetadata == null) { return(null); } } return(NuGet.VisualStudio.Internal.Contracts.PackageDeprecationMetadataContextInfo.Create(deprecationMetadata)); }
public Task <PackageDeprecationMetadata> GetDeprecationMetadataAsync() { return(_packageSearchMetadata.GetDeprecationMetadataAsync()); }