UNPKG

2.82 kBTypeScriptView Raw
1import { ChannelControlHelper, LoadBalancer, LoadBalancingConfig } from './load-balancer';
2import { ServiceConfig } from './service-config';
3import { ConfigSelector } from './resolver';
4import { StatusObject } from './call-interface';
5import { SubchannelAddress } from './subchannel-address';
6import { GrpcUri } from './uri-parser';
7import { ChannelOptions } from './channel-options';
8export interface ResolutionCallback {
9 (serviceConfig: ServiceConfig, configSelector: ConfigSelector): void;
10}
11export interface ResolutionFailureCallback {
12 (status: StatusObject): void;
13}
14export declare class ResolvingLoadBalancer implements LoadBalancer {
15 private readonly target;
16 private readonly channelControlHelper;
17 private readonly onSuccessfulResolution;
18 private readonly onFailedResolution;
19 /**
20 * The resolver class constructed for the target address.
21 */
22 private readonly innerResolver;
23 private readonly childLoadBalancer;
24 private latestChildState;
25 private latestChildPicker;
26 /**
27 * This resolving load balancer's current connectivity state.
28 */
29 private currentState;
30 private readonly defaultServiceConfig;
31 /**
32 * The service config object from the last successful resolution, if
33 * available. A value of null indicates that we have not yet received a valid
34 * service config from the resolver.
35 */
36 private previousServiceConfig;
37 /**
38 * The backoff timer for handling name resolution failures.
39 */
40 private readonly backoffTimeout;
41 /**
42 * Indicates whether we should attempt to resolve again after the backoff
43 * timer runs out.
44 */
45 private continueResolving;
46 /**
47 * Wrapper class that behaves like a `LoadBalancer` and also handles name
48 * resolution internally.
49 * @param target The address of the backend to connect to.
50 * @param channelControlHelper `ChannelControlHelper` instance provided by
51 * this load balancer's owner.
52 * @param defaultServiceConfig The default service configuration to be used
53 * if none is provided by the name resolver. A `null` value indicates
54 * that the default behavior should be the default unconfigured behavior.
55 * In practice, that means using the "pick first" load balancer
56 * implmentation
57 */
58 constructor(target: GrpcUri, channelControlHelper: ChannelControlHelper, channelOptions: ChannelOptions, onSuccessfulResolution: ResolutionCallback, onFailedResolution: ResolutionFailureCallback);
59 private updateResolution;
60 private updateState;
61 private handleResolutionFailure;
62 exitIdle(): void;
63 updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig | null): never;
64 resetBackoff(): void;
65 destroy(): void;
66 getTypeName(): string;
67}