-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Related to this pull request: #8696
Use case(s) - what problem will this feature solve?
Solves the issue of passing attributes for configuring the base balancer. Currently, you can only get connection-specific Attributes, but not general ones.
Proposed Solution
Add an Attributes field to the PickerBuildInfo:
// PickerBuildInfo contains information needed by the picker builder to
// construct a picker.
type PickerBuildInfo struct {
// ReadySCs is a map from all ready SubConns to the Addresses used to
// create them.
ReadySCs map[balancer.SubConn]SubConnInfo
// Attributes contains arbitrary data about the resolver intended for
// consumption by the load balancing policy. This is a pointer to resolver.State Attributes.
Attributes *attributes.Attributes
}Additional Context
The manual resolver has a method for updating state. The state object, which this method receives, contains a field with Attributes, which is currently impossible to obtain when implementing the PickerBuilder interface. Need to add a field with these Attributes to the PickerBuilder.
Now we can only get the field with Addresses passed in the state, there are Attributes there too, but these Attributes provide parameters of a specific address, for example, weight, but the general settings of the balancer are specified at the top level in the field with Attributes.