< Summary

Information
Class: Anichron.Worker.Ingestion.Pipeline.IngestionContext
Assembly: Anichron.Worker
File(s): /home/runner/work/anichron/anichron/src/Anichron.Worker/Ingestion/Pipeline/IngestionContext.cs
Tag: 228_36821334185
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 37
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
get_ProxyFiles()100%11100%
AddProxyFile(...)100%11100%

File(s)

/home/runner/work/anichron/anichron/src/Anichron.Worker/Ingestion/Pipeline/IngestionContext.cs

#LineLine coverage
 1using Anichron.Core.Domain;
 2
 3namespace Anichron.Worker.Ingestion.Pipeline;
 4
 5internal sealed class IngestionContext
 6{
 1167    private readonly List<ProxyFile> proxyFiles = [];
 1168    private readonly Lock proxyFilesLock = new();
 9
 10    public required IngestionItem Item { get; init; }
 11    public required UserStorageConfig Config { get; init; }
 12
 13    public required Guid AssetId { get; init; }
 14
 15    public string? ContentHash { get; set; }
 16    public string? SecondaryHash { get; set; }
 17    public ExifData? Exif { get; set; }
 18    public MediaAsset? Asset { get; set; }
 19
 20    // Records what this attempt has actually put on disk: each proxy registers itself the
 21    // moment it is renamed into place, so compensation on failure can delete precisely those
 22    // files. Image proxies are generated concurrently, hence the lock and the snapshot.
 23    public IReadOnlyList<ProxyFile> ProxyFiles
 24    {
 25        get
 5026        {
 27            lock (proxyFilesLock)
 5028                return [.. proxyFiles];
 5029        }
 30    }
 31
 32    public void AddProxyFile(ProxyFile proxyFile)
 8833    {
 34        lock (proxyFilesLock)
 8835            proxyFiles.Add(proxyFile);
 8836    }
 37}