UNPKG

2.76 kBTypeScriptView Raw
1import { ChannelControlHelper, LoadBalancer, LoadBalancingConfig } from './load-balancer';
2import { ConfigSelector } from './resolver';
3import { StatusObject } from './call-stream';
4import { SubchannelAddress } from './subchannel-address';
5import { GrpcUri } from './uri-parser';
6import { ChannelOptions } from './channel-options';
7export interface ResolutionCallback {
8 (configSelector: ConfigSelector): void;
9}
10export interface ResolutionFailureCallback {
11 (status: StatusObject): void;
12}
13export declare class ResolvingLoadBalancer implements LoadBalancer {
14 private readonly target;
15 private readonly channelControlHelper;
16 private readonly channelOptions;
17 private readonly onSuccessfulResolution;
18 private readonly onFailedResolution;
19 /**
20 * The resolver class constructed for the target address.
21 */
22 private innerResolver;
23 private 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}