1 | import { LoadBalancer, ChannelControlHelper, TypedLoadBalancingConfig } from './load-balancer';
|
2 | import { ConnectivityState } from './connectivity-state';
|
3 | import { Picker } from './picker';
|
4 | import { Endpoint } from './subchannel-address';
|
5 | import { ChannelOptions } from './channel-options';
|
6 | import { ChannelCredentials } from './channel-credentials';
|
7 | export declare class PickFirstLoadBalancingConfig implements TypedLoadBalancingConfig {
|
8 | private readonly shuffleAddressList;
|
9 | constructor(shuffleAddressList: boolean);
|
10 | getLoadBalancerName(): string;
|
11 | toJsonObject(): object;
|
12 | getShuffleAddressList(): boolean;
|
13 | static createFromJson(obj: any): PickFirstLoadBalancingConfig;
|
14 | }
|
15 | /**
|
16 | * Return a new array with the elements of the input array in a random order
|
17 | * @param list The input array
|
18 | * @returns A shuffled array of the elements of list
|
19 | */
|
20 | export declare function shuffled<T>(list: T[]): T[];
|
21 | export declare class PickFirstLoadBalancer implements LoadBalancer {
|
22 | private readonly channelControlHelper;
|
23 | |
24 |
|
25 |
|
26 |
|
27 | private children;
|
28 | |
29 |
|
30 |
|
31 | private currentState;
|
32 | |
33 |
|
34 |
|
35 |
|
36 | private currentSubchannelIndex;
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 | private currentPick;
|
43 | |
44 |
|
45 |
|
46 |
|
47 | private subchannelStateListener;
|
48 | private pickedSubchannelHealthListener;
|
49 | |
50 |
|
51 |
|
52 | private connectionDelayTimeout;
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | private stickyTransientFailureMode;
|
60 | private reportHealthStatus;
|
61 | |
62 |
|
63 |
|
64 |
|
65 | private lastError;
|
66 | private latestAddressList;
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | constructor(channelControlHelper: ChannelControlHelper, credentials: ChannelCredentials, options: ChannelOptions);
|
75 | private allChildrenHaveReportedTF;
|
76 | private resetChildrenReportedTF;
|
77 | private calculateAndReportNewState;
|
78 | private requestReresolution;
|
79 | private maybeEnterStickyTransientFailureMode;
|
80 | private removeCurrentPick;
|
81 | private onSubchannelStateUpdate;
|
82 | private startNextSubchannelConnecting;
|
83 | /**
|
84 | * Have a single subchannel in the `subchannels` list start connecting.
|
85 | * @param subchannelIndex The index into the `subchannels` list.
|
86 | */
|
87 | private startConnecting;
|
88 | /**
|
89 | * Declare that the specified subchannel should be used to make requests.
|
90 | * This functions the same independent of whether subchannel is a member of
|
91 | * this.children and whether it is equal to this.currentPick.
|
92 | * Prerequisite: subchannel.getConnectivityState() === READY.
|
93 | * @param subchannel
|
94 | */
|
95 | private pickSubchannel;
|
96 | private updateState;
|
97 | private resetSubchannelList;
|
98 | private connectToAddressList;
|
99 | updateAddressList(endpointList: Endpoint[], lbConfig: TypedLoadBalancingConfig): void;
|
100 | exitIdle(): void;
|
101 | resetBackoff(): void;
|
102 | destroy(): void;
|
103 | getTypeName(): string;
|
104 | }
|
105 | /**
|
106 | * This class handles the leaf load balancing operations for a single endpoint.
|
107 | * It is a thin wrapper around a PickFirstLoadBalancer with a different API
|
108 | * that more closely reflects how it will be used as a leaf balancer.
|
109 | */
|
110 | export declare class LeafLoadBalancer {
|
111 | private endpoint;
|
112 | private pickFirstBalancer;
|
113 | private latestState;
|
114 | private latestPicker;
|
115 | constructor(endpoint: Endpoint, channelControlHelper: ChannelControlHelper, credentials: ChannelCredentials, options: ChannelOptions);
|
116 | startConnecting(): void;
|
117 | /**
|
118 | * Update the endpoint associated with this LeafLoadBalancer to a new
|
119 | * endpoint. Does not trigger connection establishment if a connection
|
120 | * attempt is not already in progress.
|
121 | * @param newEndpoint
|
122 | */
|
123 | updateEndpoint(newEndpoint: Endpoint): void;
|
124 | getConnectivityState(): ConnectivityState;
|
125 | getPicker(): Picker;
|
126 | getEndpoint(): Endpoint;
|
127 | exitIdle(): void;
|
128 | destroy(): void;
|
129 | }
|
130 | export declare function setup(): void;
|