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 pathPackageContent.cs
More file actions
62 lines (50 loc) · 2.24 KB
/
PackageContent.cs
File metadata and controls
62 lines (50 loc) · 2.24 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
// 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.
using System.ComponentModel.DataAnnotations;
namespace NuGet.Insights.Worker.PackageContentToCsv
{
[CsvRecord]
public partial record PackageContent : PackageRecord, IAggregatedCsvRecord<PackageContent>, IPackageEntryRecord
{
public PackageContent()
{
}
public PackageContent(Guid scanId, DateTimeOffset scanTimestamp, PackageDeleteCatalogLeaf leaf)
: base(scanId, scanTimestamp, leaf)
{
ResultType = PackageContentResultType.Deleted;
}
public PackageContent(Guid scanId, DateTimeOffset scanTimestamp, PackageDetailsCatalogLeaf leaf, PackageContentResultType resultType)
: base(scanId, scanTimestamp, leaf)
{
ResultType = resultType;
}
[Required]
public PackageContentResultType ResultType { get; set; }
public string Path { get; set; }
public string FileExtension { get; set; }
public int? SequenceNumber { get; set; }
public int? Size { get; set; }
public bool? Truncated { get; set; }
public int? TruncatedSize { get; set; }
public string SHA256 { get; set; }
public string Content { get; set; }
public bool? DuplicateContent { get; set; }
public static string CsvCompactMessageSchemaName => "cc.pcn";
public static IEqualityComparer<PackageContent> KeyComparer { get; } = PackageEntryKeyComparer<PackageContent>.Instance;
public static IReadOnlyList<string> KeyFields { get; } = PackageRecordExtensions.PackageEntryKeyFields;
public static List<PackageContent> Prune(List<PackageContent> records, bool isFinalPrune, IOptions<NuGetInsightsWorkerSettings> options, ILogger logger)
{
return PackageRecordExtensions.Prune(records, isFinalPrune);
}
public int CompareTo(PackageContent other)
{
var c = base.CompareTo(other);
if (c != 0)
{
return c;
}
return Comparer<int?>.Default.Compare(SequenceNumber, other.SequenceNumber);
}
}
}