This repository was archived by the owner on Mar 31, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSymbolPackageFileToCsvDriver.cs
More file actions
70 lines (59 loc) · 2.58 KB
/
SymbolPackageFileToCsvDriver.cs
File metadata and controls
70 lines (59 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#nullable enable
using Knapcode.MiniZip;
namespace NuGet.Insights.Worker.SymbolPackageFileToCsv
{
public class SymbolPackageFileToCsvDriver : FullZipArchiveEntryToCsvDriver<SymbolPackageFileRecord>
{
private readonly SymbolPackageFileService _fileService;
private readonly SymbolPackageClient _client;
private readonly IOptions<NuGetInsightsWorkerSettings> _options;
public SymbolPackageFileToCsvDriver(
CatalogClient catalogClient,
SymbolPackageHashService hashService,
SymbolPackageFileService fileService,
SymbolPackageClient client,
FileDownloader fileDownloader,
IOptions<NuGetInsightsWorkerSettings> options,
ILogger<SymbolPackageFileToCsvDriver> logger)
: base(
catalogClient,
fileDownloader,
hashService,
logger)
{
_fileService = fileService;
_client = client;
_options = options;
}
public override string ResultContainerName => _options.Value.SymbolPackageFileContainerName;
protected override bool NotFoundIsDeleted => false;
protected override ArtifactFileType FileType => ArtifactFileType.Snupkg;
protected override async Task<ZipDirectory?> GetZipDirectoryAsync(IPackageIdentityCommit leafItem)
{
var info = await _fileService.GetZipDirectoryAndLengthAsync(leafItem);
if (!info.HasValue)
{
return null;
}
return info.Value.Directory;
}
protected override Task<string> GetZipUrlAsync(CatalogLeafScan leafScan)
{
return Task.FromResult(_client.GetSymbolPackageUrl(leafScan.PackageId, leafScan.PackageVersion));
}
protected override async Task InternalInitializeAsync()
{
await _fileService.InitializeAsync();
}
protected override SymbolPackageFileRecord NewDeleteRecord(Guid scanId, DateTimeOffset scanTimestamp, PackageDeleteCatalogLeaf leaf)
{
return new SymbolPackageFileRecord(scanId, scanTimestamp, leaf);
}
protected override SymbolPackageFileRecord NewDetailsRecord(Guid scanId, DateTimeOffset scanTimestamp, PackageDetailsCatalogLeaf leaf)
{
return new SymbolPackageFileRecord(scanId, scanTimestamp, leaf);
}
}
}