Hi,
I'd like to implement Picker with some custom configuration. Unfortunately, after reading sources I did not see any possibility to do it except of global variable with necessary fields. I plan to use some DI framework or/and some settings provider service. However, I'd like to keep implementation simple and provide only some plain struct to building functions. Are there any simple way to do this? Can balancer with properly configured PickerBuilder be registered after init function?
https://github.com/grpc/grpc-go/blob/master/resolver/resolver.go#L113
is for that
which for every balancer.SubConn inside base.PickerBuildInfo.ReadySCs available for V2PickerBuilder
To configure your load balancer after init time, you would want to use the service config's loadBalancingConfig field. https://github.com/grpc/proposal/blob/master/A24-lb-policy-config.md
This can be specified statically by the client via https://godoc.org/google.golang.org/grpc#WithDefaultServiceConfig or dynamically via the name resolver.
Or, as @un000 said, you could use the Attributes field (either in the Addresses or in the resolver.State).
Thank you, I used Attributes field, it perfectly fits my needs.