Skip to content

IQuotaGate

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Providers

IQuotaGate Interface

Gates provider access based on quota. Before each provider attempt, the selector calls TryReserveAsync(string, CancellationToken). If denied, the provider is skipped. After the attempt, ReleaseAsync(string, bool, CancellationToken) reports success or failure.

public interface IQuotaGate

Derived
AlwaysGrantQuotaGate

Methods

IQuotaGate.ReleaseAsync(string, bool, CancellationToken) Method

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

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

Parameters

providerName System.String

The provider that was attempted.

succeeded System.Boolean

Whether the provider call succeeded.

cancellationToken System.Threading.CancellationToken

Cancellation token.

Returns

System.Threading.Tasks.Task

IQuotaGate.TryReserveAsync(string, CancellationToken) Method

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

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

Parameters

providerName System.String

The provider requesting quota.

cancellationToken System.Threading.CancellationToken

Cancellation token.

Returns

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