public async Task ExecuteAsync()
        {
            var blobClient = BlobStorageUtilities.GetBlobClient(_globalContext);

            // Clean up catalog2lucene containers.
            var luceneContainers = blobClient.ListContainers("v3-lucene-");

            foreach (var container in luceneContainers)
            {
                await CleanUpUtilities.DeleteContainer(blobClient, container.Name, _logger);
            }

            var luceneCachePath = CleanUpUtilities.GetLuceneCacheDirectory();

            foreach (var directory in Directory.EnumerateDirectories(luceneCachePath, "v3-lucene-"))
            {
                Directory.Delete(directory, recursive: true);
            }

            await CleanUpUtilities.DeleteContainer(blobClient, _globalContext.RegistrationContainerName, _logger);

            await CleanUpUtilities.DeleteContainer(blobClient, _globalContext.FlatContainerContainerName, _logger);

            await CleanUpUtilities.DeleteContainer(blobClient, _globalContext.CatalogContainerName, _logger);
        }
        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);
        }
Beispiel #3
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);
        }