-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSurgeResourceBudget.cs
More file actions
46 lines (41 loc) · 1.52 KB
/
SurgeResourceBudget.cs
File metadata and controls
46 lines (41 loc) · 1.52 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
namespace Surge
{
/// <summary>
/// Configuration for resource usage limits during update operations.
/// Maps to the native surge_resource_budget struct.
/// </summary>
public sealed class SurgeResourceBudget
{
/// <summary>
/// Maximum memory usage in bytes. 0 means unlimited.
/// </summary>
public long MaxMemoryBytes { get; set; }
/// <summary>
/// Maximum number of threads for parallel operations. 0 means auto-detect.
/// </summary>
public int MaxThreads { get; set; }
/// <summary>
/// Maximum number of concurrent download connections.
/// </summary>
public int MaxConcurrentDownloads { get; set; } = 4;
/// <summary>
/// Maximum download speed in bytes per second. 0 means unlimited.
/// </summary>
public long MaxDownloadSpeedBps { get; set; }
/// <summary>
/// Zstandard compression level (1-22). Higher values use more CPU but produce smaller packages.
/// </summary>
public int ZstdCompressionLevel { get; set; } = 9;
internal SurgeResourceBudgetNative ToNative()
{
return new SurgeResourceBudgetNative
{
MaxMemoryBytes = MaxMemoryBytes,
MaxThreads = MaxThreads,
MaxConcurrentDownloads = MaxConcurrentDownloads,
MaxDownloadSpeedBps = MaxDownloadSpeedBps,
ZstdCompressionLevel = ZstdCompressionLevel
};
}
}
}