Files
natsdotnet/src/NATS.Server/Auth/AccountLimits.cs
Joseph Doherty 235971ddcc feat(auth): add account import/export cycle detection and JetStream limits (E4+E5)
E4: AccountImportExport with DFS cycle detection for service imports,
RemoveServiceImport/RemoveStreamImport, and ValidateImport authorization.
E5: AccountLimits record with MaxStorage/MaxConsumers/MaxAckPending,
TryReserveConsumer/ReleaseConsumer, TrackStorageDelta on Account.
20 new tests, all passing.
2026-02-24 15:25:12 -05:00

33 lines
1.2 KiB
C#

// Per-account JetStream resource limits.
// Go reference: accounts.go JetStreamAccountLimits struct.
namespace NATS.Server.Auth;
/// <summary>
/// Per-account limits on JetStream resources: storage, streams, consumers, and ack pending.
/// A value of 0 means unlimited for all fields.
/// </summary>
public sealed record AccountLimits
{
/// <summary>Maximum total storage in bytes (0 = unlimited).</summary>
public long MaxStorage { get; init; }
/// <summary>Maximum number of streams (0 = unlimited).</summary>
public int MaxStreams { get; init; }
/// <summary>Maximum number of consumers (0 = unlimited).</summary>
public int MaxConsumers { get; init; }
/// <summary>Maximum pending ack count per consumer (0 = unlimited).</summary>
public int MaxAckPending { get; init; }
/// <summary>Maximum memory-based storage in bytes (0 = unlimited).</summary>
public long MaxMemoryStorage { get; init; }
/// <summary>Maximum disk-based storage in bytes (0 = unlimited).</summary>
public long MaxDiskStorage { get; init; }
/// <summary>Default instance with all limits set to unlimited (0).</summary>
public static AccountLimits Unlimited { get; } = new();
}