public async Task CleanUpAsync(PerProcessContext context)
        {
            var blobClient = BlobStorageUtilities.GetBlobClient(context.Global);

            // Delete catalog2dnx artifacts.
            await CleanUpUtilities.DeleteBlobsWithPrefix(
                blobClient,
                context.Global.FlatContainerContainerName,
                context.FlatContainerStoragePath,
                _logger);
        }
Example #2
0
        public async Task CleanUpAsync(PerBatchContext context, IReadOnlyList <PerPackageContext> packageContexts)
        {
            var blobClient = BlobStorageUtilities.GetBlobClient(context.Global);

            // Delete catalog2lucene artifacts.
            await CleanUpUtilities.DeleteContainer(blobClient, context.LuceneContainerName, _logger);

            var luceneCachePath = Path.Combine(
                CleanUpUtilities.GetLuceneCacheDirectory(),
                context.LuceneContainerName);

            if (Directory.Exists(luceneCachePath))
            {
                Directory.Delete(luceneCachePath, recursive: true);
            }

            // Delete catalog2registration artifacts.
            await CleanUpUtilities.DeleteBlobsWithPrefix(
                blobClient,
                context.Global.RegistrationContainerName,
                context.Worker.Name,
                _logger);

            // Delete catalog2dnx artifacts.
            foreach (var packageContext in packageContexts)
            {
                await CleanUpUtilities.DeleteBlobsWithPrefix(
                    blobClient,
                    context.Global.FlatContainerContainerName,
                    $"{context.Process.FlatContainerStoragePath}/{packageContext.PackageId.ToLowerInvariant()}/{packageContext.PackageVersion.ToLowerInvariant()}",
                    _logger);
            }

            // Delete feed2catalog artifacts.
            await CleanUpUtilities.DeleteBlobsWithPrefix(
                blobClient,
                context.Global.CatalogContainerName,
                context.Worker.Name,
                _logger);
        }