UNPKG

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