load-balancer-pick-first.d.ts
2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { LoadBalancer, ChannelControlHelper, LoadBalancingConfig } from './load-balancer';
import { SubchannelAddress } from './subchannel';
export declare class PickFirstLoadBalancingConfig implements LoadBalancingConfig {
getLoadBalancerName(): string;
constructor();
toJsonObject(): object;
static createFromJson(obj: any): PickFirstLoadBalancingConfig;
}
export declare class PickFirstLoadBalancer implements LoadBalancer {
private readonly channelControlHelper;
/**
* The list of backend addresses most recently passed to `updateAddressList`.
*/
private latestAddressList;
/**
* The list of subchannels this load balancer is currently attempting to
* connect to.
*/
private subchannels;
/**
* The current connectivity state of the load balancer.
*/
private currentState;
/**
* The index within the `subchannels` array of the subchannel with the most
* recently started connection attempt.
*/
private currentSubchannelIndex;
private subchannelStateCounts;
/**
* The currently picked subchannel used for making calls. Populated if
* and only if the load balancer's current state is READY. In that case,
* the subchannel's current state is also READY.
*/
private currentPick;
/**
* Listener callback attached to each subchannel in the `subchannels` list
* while establishing a connection.
*/
private subchannelStateListener;
/**
* Listener callback attached to the current picked subchannel.
*/
private pickedSubchannelStateListener;
/**
* Timer reference for the timer tracking when to start
*/
private connectionDelayTimeout;
private triedAllSubchannels;
/**
* Load balancer that attempts to connect to each backend in the address list
* in order, and picks the first one that connects, using it for every
* request.
* @param channelControlHelper `ChannelControlHelper` instance provided by
* this load balancer's owner.
*/
constructor(channelControlHelper: ChannelControlHelper);
private startNextSubchannelConnecting;
/**
* Have a single subchannel in the `subchannels` list start connecting.
* @param subchannelIndex The index into the `subchannels` list.
*/
private startConnecting;
private pickSubchannel;
private updateState;
private resetSubchannelList;
/**
* Start connecting to the address list most recently passed to
* `updateAddressList`.
*/
private connectToAddressList;
updateAddressList(addressList: SubchannelAddress[], lbConfig: LoadBalancingConfig): void;
exitIdle(): void;
resetBackoff(): void;
destroy(): void;
getTypeName(): string;
}
export declare function setup(): void;