Class QuotaService
- Namespace
- FoundationaLLM.Common.Services.Quota
- Assembly
- FoundationaLLM.Common.dll
Implements the FoundationaLLM quota service.
public class QuotaService : IQuotaService
- Inheritance
-
QuotaService
- Implements
- Inherited Members
- Extension Methods
Constructors
QuotaService(DependencyInjectionContainerSettings, IStorageService, IEventService, ILoggerFactory)
Initializes a new instance of the QuotaService class.
public QuotaService(DependencyInjectionContainerSettings dependencyInjectionContainerSettings, IStorageService storageService, IEventService eventService, ILoggerFactory loggerFactory)
Parameters
dependencyInjectionContainerSettings
DependencyInjectionContainerSettingsThe DependencyInjectionContainerSettings providing the configuration of the dependency injection container.
storageService
IStorageServiceThe storage service used for storing quota configuration.
eventService
IEventServiceThe IEventService providing event services to the quota service.
loggerFactory
ILoggerFactoryThe logger factory used to create loggers.
Properties
Enabled
Indicates whether the quota service is enabled.
public bool Enabled { get; }
Property Value
InitializationTask
Gets the TaskCompletionSource<TResult> (TResult
of type bool)
that signals the completion of the initialization task.
public Task<bool> InitializationTask { get; }
Property Value
Remarks
The result of the task indicates whether initialization completed successfully or not.
Methods
EvaluateCompletionRequestForQuota(string, string, UnifiedUserIdentity?, CompletionRequest)
Evaluates a completion request to determine if it exceeds any quotas.
public QuotaMetricPartitionState EvaluateCompletionRequestForQuota(string apiName, string controllerName, UnifiedUserIdentity? userIdentity, CompletionRequest completionRequest)
Parameters
apiName
stringThe name of the API handling the request.
controllerName
stringThe name of the ASP.NET controller handling the request.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing the user identity associated with the request.
completionRequest
CompletionRequestThe CompletionRequest providing the completion request details.
Returns
EvaluateRawRequestForQuota(string, string?, UnifiedUserIdentity?)
Evaluates an HTTP API request to determine if it exceeds any quotas.
public QuotaMetricPartitionState EvaluateRawRequestForQuota(string apiName, string? controllerName, UnifiedUserIdentity? userIdentity)
Parameters
apiName
stringThe name of the API handling the request.
controllerName
stringThe name of the ASP.NET controller handling the request.
userIdentity
UnifiedUserIdentityThe UnifiedUserIdentity providing the user identity associated with the request.
Returns
- QuotaMetricPartitionState
An QuotaMetricPartitionState object that indicates if any quotas where exceeded and provides details in case of a quota breach.