Skip to content

apollo-code


apollo-code / router/src / RoleRouter

Class: RoleRouter

Role selection layered over FallbackRouter's retry, cooldown, budget, and sticky policy.

Implements

Constructors

Constructor

new RoleRouter(registry, config, options?): RoleRouter

Parameters

registry

ProviderRegistry

config

RoleRouterConfig

options?

FallbackRouterOptions & object = {}

Returns

RoleRouter

Properties

name

readonly name: "role" = 'role'

Implementation of

RouterPolicy.name

Methods

onError()

onError(error, ctx): Promise<RouterDecision | "give-up">

Parameters

error

ProviderError

ctx

RouterContext

Returns

Promise<RouterDecision | "give-up">

Implementation of

RouterPolicy.onError


onSuccess()

onSuccess(decision, ctx): Promise<void>

Parameters

decision

RouterDecision

ctx

RouterContext

Returns

Promise<void>

Implementation of

RouterPolicy.onSuccess


pick()

pick(ctx, hint?): Promise<RouterDecision>

Parameters

ctx

RouterContext

hint?

RouterHint

Returns

Promise<RouterDecision>

Implementation of

RouterPolicy.pick