import { experimental, LoadBalancingConfig, ChannelOptions } from '@grpc/grpc-js'; import LoadBalancer = experimental.LoadBalancer; import ChannelControlHelper = experimental.ChannelControlHelper; import Endpoint = experimental.Endpoint; import TypedLoadBalancingConfig = experimental.TypedLoadBalancingConfig; import StatusOr = experimental.StatusOr; import { Locality__Output } from './generated/envoy/config/core/v3/Locality'; export interface LocalityEndpoint extends Endpoint { /** * A sequence of strings that determines how to divide endpoints up in priority and * weighted_target. */ localityPath: string[]; /** * The locality this endpoint is in. Used in wrr_locality and xds_cluster_impl. */ locality: Locality__Output; /** * The load balancing weight for the entire locality that contains this * endpoint. Used in xds_wrr_locality. */ localityWeight: number; /** * The overall load balancing weight for this endpoint, calculated as the * product of the load balancing weight for this endpoint within its locality * and the load balancing weight of the locality. Used in ring_hash. */ endpointWeight: number; } export declare function isLocalityEndpoint(address: Endpoint): address is LocalityEndpoint; /** * Type of the config for an individual child in the JSON representation of * a priority LB policy config. */ export interface PriorityChildRaw { config: LoadBalancingConfig[]; ignore_reresolution_requests: boolean; } /** * The JSON representation of the config for the priority LB policy. The * LoadBalancingConfig for a priority policy should have the form * { priority: PriorityRawConfig } */ export interface PriorityRawConfig { children: { [name: string]: PriorityChildRaw; }; priorities: string[]; } export declare class PriorityLoadBalancer implements LoadBalancer { private channelControlHelper; /** * Inner class for holding a child priority and managing associated timers. */ private PriorityChildImpl; private children; /** * The priority order of child names from the latest config update. */ private priorities; /** * The attributes object from the latest update, saved to be passed along to * each new child as they are created */ private latestOptions; /** * The latest load balancing policies and address lists for each child from * the latest update */ private latestUpdates; /** * Current chosen priority that requests are sent to */ private currentPriority; private updatesPaused; private latestResolutionNote; constructor(channelControlHelper: ChannelControlHelper); private updateState; private onChildStateChange; private deleteChild; /** * Select the child at the specified priority, and report that child's state * as this balancer's state until that child disconnects or a higher-priority * child connects. * @param priority */ private selectPriority; private choosePriority; updateAddressList(endpointList: StatusOr, lbConfig: TypedLoadBalancingConfig, options: ChannelOptions, resolutionNote: string): boolean; exitIdle(): void; resetBackoff(): void; destroy(): void; getTypeName(): string; } export declare function setup(): void;