Skip to content

AlwaysGrantQuotaGate

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Providers

AlwaysGrantQuotaGate Class

IQuotaGate that always grants reservations. Suitable for development and scenarios where quota tracking is not needed.

public sealed class AlwaysGrantQuotaGate : NexusLabs.Needlr.AgentFramework.Providers.IQuotaGate

Inheritance System.Object 🡒 AlwaysGrantQuotaGate

Implements IQuotaGate

Methods

AlwaysGrantQuotaGate.ReleaseAsync(string, string, bool, CancellationToken) Method

Releases a previously granted reservation, reporting whether the attempt succeeded.

public System.Threading.Tasks.Task ReleaseAsync(string providerName, string? quotaPartition, bool succeeded, System.Threading.CancellationToken cancellationToken);

Parameters

providerName System.String

The provider that was attempted.

quotaPartition System.String

The same partition key that was passed to TryReserveAsync(string, string, CancellationToken).

succeeded System.Boolean

Whether the provider call succeeded.

cancellationToken System.Threading.CancellationToken

Cancellation token.

Implements ReleaseAsync(string, string, bool, CancellationToken)

Returns

System.Threading.Tasks.Task

AlwaysGrantQuotaGate.TryReserveAsync(string, string, CancellationToken) Method

Attempts to reserve quota for the given provider and partition. Returns true if the reservation was granted, false if denied.

public System.Threading.Tasks.Task<bool> TryReserveAsync(string providerName, string? quotaPartition, System.Threading.CancellationToken cancellationToken);

Parameters

providerName System.String

The provider requesting quota.

quotaPartition System.String

Partition key that scopes the quota (e.g., user ID, tenant ID, API key). Pass null for global (unpartitioned) quota.

cancellationToken System.Threading.CancellationToken

Cancellation token.

Implements TryReserveAsync(string, string, CancellationToken)

Returns

System.Threading.Tasks.Task<System.Boolean>