1- // Copyright (c) .NET Foundation. All rights reserved.
1+ // Copyright (c) .NET Foundation. All rights reserved.
22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33
44using System ;
1616using NuGet . Versioning ;
1717
1818using ILogger = Microsoft . Extensions . Logging . ILogger ;
19+ using CatalogStorage = NuGet . Services . Metadata . Catalog . Persistence . Storage ;
1920
2021namespace NuGet . Services . Metadata . Catalog . Dnx
2122{
@@ -154,7 +155,7 @@ public async Task DeletePackageAsync(string id, string version, CancellationToke
154155 await DeleteNupkgAsync ( storage , id , normalizedVersion , cancellationToken ) ;
155156 }
156157
157- public async Task < bool > HasPackageInIndexAsync ( Storage storage , string id , string version , CancellationToken cancellationToken )
158+ public async Task < bool > HasPackageInIndexAsync ( CatalogStorage storage , string id , string version , CancellationToken cancellationToken )
158159 {
159160 if ( storage == null )
160161 {
@@ -179,7 +180,7 @@ public async Task<bool> HasPackageInIndexAsync(Storage storage, string id, strin
179180 return versionsContext . Versions . Contains ( parsedVersion ) ;
180181 }
181182
182- private async Task < Uri > SaveNuspecAsync ( Storage storage , string id , string version , string nuspec , CancellationToken cancellationToken )
183+ private async Task < Uri > SaveNuspecAsync ( CatalogStorage storage , string id , string version , string nuspec , CancellationToken cancellationToken )
183184 {
184185 var relativeAddress = GetRelativeAddressNuspec ( id , version ) ;
185186 var nuspecUri = new Uri ( storage . BaseAddress , relativeAddress ) ;
@@ -230,7 +231,7 @@ public async Task UpdatePackageVersionIndexAsync(string id, Action<HashSet<NuGet
230231 }
231232 }
232233
233- private async Task < VersionsResult > GetVersionsAsync ( Storage storage , CancellationToken cancellationToken )
234+ private async Task < VersionsResult > GetVersionsAsync ( CatalogStorage storage , CancellationToken cancellationToken )
234235 {
235236 var relativeAddress = "index.json" ;
236237 var resourceUri = new Uri ( storage . BaseAddress , relativeAddress ) ;
@@ -265,7 +266,7 @@ private StorageContent CreateContent(IEnumerable<string> versions)
265266 return new StringStorageContent ( obj . ToString ( ) , "application/json" , Constants . NoStoreCacheControl ) ;
266267 }
267268
268- private async Task < Uri > SaveNupkgAsync ( Stream nupkgStream , Storage storage , string id , string version , CancellationToken cancellationToken )
269+ private async Task < Uri > SaveNupkgAsync ( Stream nupkgStream , CatalogStorage storage , string id , string version , CancellationToken cancellationToken )
269270 {
270271 Uri nupkgUri = new Uri ( storage . BaseAddress , GetRelativeAddressNupkg ( id , version ) ) ;
271272 var content = new StreamStorageContent (
@@ -280,7 +281,7 @@ private async Task<Uri> SaveNupkgAsync(Stream nupkgStream, Storage storage, stri
280281
281282 private async Task < Uri > CopyNupkgAsync (
282283 IStorage sourceStorage ,
283- Storage destinationStorage ,
284+ CatalogStorage destinationStorage ,
284285 string id , string version , CancellationToken cancellationToken )
285286 {
286287 var packageFileName = PackageUtility . GetPackageFileName ( id , version ) ;
@@ -300,7 +301,7 @@ await sourceStorage.CopyAsync(
300301
301302 private async Task CopyIconFromAzureStorageIfExistAsync (
302303 IAzureStorage sourceStorage ,
303- Storage destinationStorage ,
304+ CatalogStorage destinationStorage ,
304305 string packageId ,
305306 string normalizedPackageVersion ,
306307 string iconFilename ,
@@ -321,7 +322,7 @@ await CopyIconAsync(
321322 private async Task CopyIconFromNupkgStreamAsync (
322323 Stream nupkgStream ,
323324 string iconFilename ,
324- Storage destinationStorage ,
325+ CatalogStorage destinationStorage ,
325326 string packageId ,
326327 string normalizedPackageVersion ,
327328 CancellationToken cancellationToken )
@@ -338,7 +339,7 @@ await CopyIconAsync(
338339 private async Task CopyIconAsync (
339340 Stream packageStream ,
340341 string iconFilename ,
341- Storage destinationStorage ,
342+ CatalogStorage destinationStorage ,
342343 string packageId ,
343344 string normalizedPackageVersion ,
344345 CancellationToken cancellationToken )
@@ -366,7 +367,7 @@ await ExtractAndStoreIconAsync(
366367 private async Task ExtractAndStoreIconAsync (
367368 Stream packageStream ,
368369 string iconPath ,
369- Storage destinationStorage ,
370+ CatalogStorage destinationStorage ,
370371 Uri destinationUri ,
371372 CancellationToken cancellationToken ,
372373 string packageId ,
@@ -406,7 +407,7 @@ private async Task<Stream> GetPackageStreamAsync(
406407 return await packageSourceBlob . GetStreamAsync ( cancellationToken ) ;
407408 }
408409
409- private async Task DeleteNuspecAsync ( Storage storage , string id , string version , CancellationToken cancellationToken )
410+ private async Task DeleteNuspecAsync ( CatalogStorage storage , string id , string version , CancellationToken cancellationToken )
410411 {
411412 string relativeAddress = GetRelativeAddressNuspec ( id , version ) ;
412413 Uri nuspecUri = new Uri ( storage . BaseAddress , relativeAddress ) ;
@@ -416,7 +417,7 @@ private async Task DeleteNuspecAsync(Storage storage, string id, string version,
416417 }
417418 }
418419
419- private async Task DeleteNupkgAsync ( Storage storage , string id , string version , CancellationToken cancellationToken )
420+ private async Task DeleteNupkgAsync ( CatalogStorage storage , string id , string version , CancellationToken cancellationToken )
420421 {
421422 string relativeAddress = GetRelativeAddressNupkg ( id , version ) ;
422423 Uri nupkgUri = new Uri ( storage . BaseAddress , relativeAddress ) ;
@@ -426,7 +427,7 @@ private async Task DeleteNupkgAsync(Storage storage, string id, string version,
426427 }
427428 }
428429
429- private async Task DeleteIconAsync ( Storage storage , string id , string version , CancellationToken cancellationToken )
430+ private async Task DeleteIconAsync ( CatalogStorage storage , string id , string version , CancellationToken cancellationToken )
430431 {
431432 string relativeAddress = GetRelativeAddressIcon ( id , version ) ;
432433 Uri iconUri = new Uri ( storage . BaseAddress , relativeAddress ) ;
@@ -479,4 +480,4 @@ public VersionsResult(string relativeAddress, Uri resourceUri, HashSet<NuGetVers
479480 public HashSet < NuGetVersion > Versions { get ; }
480481 }
481482 }
482- }
483+ }
0 commit comments