diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-04-26 23:50:19 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-04-26 23:50:19 -0500 |
| commit | 3eec5bd5d1f6ebd48ce183435cca4a96740c35ba (patch) | |
| tree | 478ce2378161bafab0408211c605f4168e850741 /src/slskd/Transfers/Types | |
| parent | 9507e547dd68f1142b0b7a455a52ce5b6ad3d50e (diff) | |
| download | slskd-3eec5bd5d1f6ebd48ce183435cca4a96740c35ba.tar.gz | |
optimized list and find
Diffstat (limited to 'src/slskd/Transfers/Types')
| -rw-r--r-- | src/slskd/Transfers/Types/Batch.cs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/slskd/Transfers/Types/Batch.cs b/src/slskd/Transfers/Types/Batch.cs index aa61f069..e15ecde3 100644 --- a/src/slskd/Transfers/Types/Batch.cs +++ b/src/slskd/Transfers/Types/Batch.cs @@ -40,20 +40,20 @@ using System.Linq; using System.Text.Json.Serialization; using Soulseek; -public class Batch +public record Batch { public Guid? SearchId { get; init; } = null; [Key] public Guid Id { get; init; } public string Username { get; init; } - public TransferDirection Direction { get; } = TransferDirection.Download; + public TransferDirection Direction { get; init; } = TransferDirection.Download; public string Destination { get; init; } public int Files { get; init; } public long Size { get; init; } [NotMapped] - public TransferStates State => ComputeState(); + public TransferStates State { get; init; } public DateTime CreatedAt { get; init; } = DateTime.UtcNow; public DateTime? EndedAt { get; set; } // todo: set when the last file is completed, for performance reasons @@ -64,25 +64,25 @@ public class Batch /// <remarks> /// Lazy loaded. If not loaded with the batch record, the collection and all of the statistics will be null. /// </remarks> - public ICollection<Transfer> Transfers { get; set; } + public ICollection<Transfer> Transfers { get; init; } [NotMapped] - public long BytesTransferred { get; set; } + public long BytesTransferred { get; init; } [NotMapped] - public long BytesRemaining { get; set; } + public long BytesRemaining { get; init; } [NotMapped] public TimeSpan ElapsedTime => (EndedAt ?? DateTime.UtcNow) - CreatedAt; [NotMapped] - public double PercentComplete { get; set; } + public double PercentComplete { get; init; } [NotMapped] - public double AverageSpeed { get; set; } + public double AverageSpeed { get; init; } [JsonIgnore] - public bool Removed { get; set; } + public bool Removed { get; init; } private TransferStates ComputeState() { |
