Skip to content

Commit 49b7c6a

Browse files
committed
grpc-js: Make pick_first the universal leaf policy, switch to endpoint lists
1 parent 9272aee commit 49b7c6a

19 files changed

+668
-504
lines changed

packages/grpc-js/src/experimental.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ export {
1717
registerLoadBalancerType,
1818
selectLbConfigFromList,
1919
parseLoadBalancingConfig,
20-
isLoadBalancerNameRegistered
20+
isLoadBalancerNameRegistered,
2121
} from './load-balancer';
22+
export { LeafLoadBalancer } from './load-balancer-pick-first';
2223
export {
2324
SubchannelAddress,
2425
subchannelAddressToString,
26+
Endpoint,
27+
endpointToString,
28+
endpointHasAddress,
2529
} from './subchannel-address';
2630
export { ChildLoadBalancerHandler } from './load-balancer-child-handler';
2731
export {

packages/grpc-js/src/load-balancer-child-handler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
TypedLoadBalancingConfig,
2222
createLoadBalancer,
2323
} from './load-balancer';
24-
import { SubchannelAddress } from './subchannel-address';
24+
import { Endpoint, SubchannelAddress } from './subchannel-address';
2525
import { ChannelOptions } from './channel-options';
2626
import { ConnectivityState } from './connectivity-state';
2727
import { Picker } from './picker';
@@ -95,12 +95,12 @@ export class ChildLoadBalancerHandler implements LoadBalancer {
9595

9696
/**
9797
* Prerequisites: lbConfig !== null and lbConfig.name is registered
98-
* @param addressList
98+
* @param endpointList
9999
* @param lbConfig
100100
* @param attributes
101101
*/
102102
updateAddressList(
103-
addressList: SubchannelAddress[],
103+
endpointList: Endpoint[],
104104
lbConfig: TypedLoadBalancingConfig,
105105
attributes: { [key: string]: unknown }
106106
): void {
@@ -131,7 +131,7 @@ export class ChildLoadBalancerHandler implements LoadBalancer {
131131
}
132132
}
133133
this.latestConfig = lbConfig;
134-
childToUpdate.updateAddressList(addressList, lbConfig, attributes);
134+
childToUpdate.updateAddressList(endpointList, lbConfig, attributes);
135135
}
136136
exitIdle(): void {
137137
if (this.currentChild) {

0 commit comments

Comments
 (0)