Skip to content

TieredProviderSelector TQuery,TResult

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Providers

TieredProviderSelector<TQuery,TResult> Class

Default ITieredProviderSelector<TQuery,TResult> that iterates providers in ascending Priority order, gated by an IQuotaGate. On ProviderUnavailableException the selector falls through to the next provider.

public sealed class TieredProviderSelector<TQuery,TResult> : NexusLabs.Needlr.AgentFramework.Providers.ITieredProviderSelector<TQuery, TResult>

Type parameters

TQuery

TResult

Inheritance System.Object 🡒 TieredProviderSelector\<TQuery,TResult>

Implements NexusLabs.Needlr.AgentFramework.Providers.ITieredProviderSelector<TQuery,TResult>

Constructors

TieredProviderSelector(IEnumerable<ITieredProvider<TQuery,TResult>>, IQuotaGate) Constructor

public TieredProviderSelector(System.Collections.Generic.IEnumerable<NexusLabs.Needlr.AgentFramework.Providers.ITieredProvider<TQuery,TResult>> providers, NexusLabs.Needlr.AgentFramework.Providers.IQuotaGate quotaGate);

Parameters

providers System.Collections.Generic.IEnumerable<NexusLabs.Needlr.AgentFramework.Providers.ITieredProvider<TQuery,TResult>>

All registered providers (filtering and ordering is handled internally).

quotaGate IQuotaGate

Quota gate for reservation/release. Use AlwaysGrantQuotaGate for no-op.

Methods

TieredProviderSelector<TQuery,TResult>.ExecuteAsync(TQuery, CancellationToken) Method

Executes the query against providers in priority order until one succeeds.

public System.Threading.Tasks.Task<TResult> ExecuteAsync(TQuery query, System.Threading.CancellationToken cancellationToken);

Parameters

query TQuery

cancellationToken System.Threading.CancellationToken

Implements ExecuteAsync(TQuery, CancellationToken)

Returns

System.Threading.Tasks.Task<TResult>

Exceptions

System.InvalidOperationException
All providers failed or none are enabled.