mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
grpc-js: Add attributes argument passed from resolver to load balancer
This commit is contained in:
parent
b4af434b37
commit
08dd114951
@ -67,7 +67,8 @@ export interface LoadBalancer {
|
||||
*/
|
||||
updateAddressList(
|
||||
addressList: SubchannelAddress[],
|
||||
lbConfig: LoadBalancingConfig | null
|
||||
lbConfig: LoadBalancingConfig | null,
|
||||
attributes: {[key: string]: unknown}
|
||||
): void;
|
||||
/**
|
||||
* If the load balancer is currently in the IDLE state, start connecting.
|
||||
|
||||
@ -124,7 +124,7 @@ class DnsResolver implements Resolver {
|
||||
if (this.ipResult !== null) {
|
||||
trace('Returning IP address for target ' + uriToString(this.target));
|
||||
setImmediate(() => {
|
||||
this.listener.onSuccessfulResolution(this.ipResult!, null, null);
|
||||
this.listener.onSuccessfulResolution(this.ipResult!, null, null, {});
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -186,7 +186,8 @@ class DnsResolver implements Resolver {
|
||||
this.listener.onSuccessfulResolution(
|
||||
this.latestLookupResult,
|
||||
this.latestServiceConfig,
|
||||
this.latestServiceConfigError
|
||||
this.latestServiceConfigError,
|
||||
{}
|
||||
);
|
||||
},
|
||||
(err) => {
|
||||
@ -230,7 +231,8 @@ class DnsResolver implements Resolver {
|
||||
this.listener.onSuccessfulResolution(
|
||||
this.latestLookupResult,
|
||||
this.latestServiceConfig,
|
||||
this.latestServiceConfigError
|
||||
this.latestServiceConfigError,
|
||||
{}
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -244,7 +246,8 @@ class DnsResolver implements Resolver {
|
||||
this.listener.onSuccessfulResolution(
|
||||
this.latestLookupResult,
|
||||
this.latestServiceConfig,
|
||||
this.latestServiceConfigError
|
||||
this.latestServiceConfigError,
|
||||
{}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,8 @@ class UdsResolver implements Resolver {
|
||||
this.listener.onSuccessfulResolution,
|
||||
this.addresses,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,8 @@ export interface ResolverListener {
|
||||
onSuccessfulResolution(
|
||||
addressList: SubchannelAddress[],
|
||||
serviceConfig: ServiceConfig | null,
|
||||
serviceConfigError: StatusObject | null
|
||||
serviceConfigError: StatusObject | null,
|
||||
attributes: {[key: string]: unknown}
|
||||
): void;
|
||||
/**
|
||||
* Called whenever a name resolution attempt fails.
|
||||
|
||||
@ -136,7 +136,8 @@ export class ResolvingLoadBalancer implements LoadBalancer {
|
||||
onSuccessfulResolution: (
|
||||
addressList: SubchannelAddress[],
|
||||
serviceConfig: ServiceConfig | null,
|
||||
serviceConfigError: ServiceError | null
|
||||
serviceConfigError: ServiceError | null,
|
||||
attributes: {[key: string]: unknown}
|
||||
) => {
|
||||
let workingServiceConfig: ServiceConfig | null = null;
|
||||
/* This first group of conditionals implements the algorithm described
|
||||
@ -211,12 +212,14 @@ export class ResolvingLoadBalancer implements LoadBalancer {
|
||||
)!;
|
||||
this.innerLoadBalancer.updateAddressList(
|
||||
addressList,
|
||||
loadBalancingConfig
|
||||
loadBalancingConfig,
|
||||
attributes
|
||||
);
|
||||
} else if (this.innerLoadBalancer.getTypeName() === loadBalancerName) {
|
||||
this.innerLoadBalancer.updateAddressList(
|
||||
addressList,
|
||||
loadBalancingConfig
|
||||
loadBalancingConfig,
|
||||
attributes
|
||||
);
|
||||
} else {
|
||||
if (
|
||||
@ -234,7 +237,8 @@ export class ResolvingLoadBalancer implements LoadBalancer {
|
||||
}
|
||||
this.pendingReplacementLoadBalancer.updateAddressList(
|
||||
addressList,
|
||||
loadBalancingConfig
|
||||
loadBalancingConfig,
|
||||
attributes
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user