Documentation
¶
Index ¶
- Constants
- func NewConsistentHashringBuilder(pickerBuilder base.PickerBuilder) balancer.Builder
- type ConsistentHashringPickerBuilder
- func (b *ConsistentHashringPickerBuilder) Build(info base.PickerBuildInfo) balancer.Picker
- func (b *ConsistentHashringPickerBuilder) MarshalZerologObject(e *zerolog.Event)
- func (b *ConsistentHashringPickerBuilder) MustReplicationFactor(rf uint16)
- func (b *ConsistentHashringPickerBuilder) MustSpread(spread uint8)
Constants ¶
View Source
const ( // BalancerName is the name of consistent-hashring balancer. BalancerName = "consistent-hashring" // BalancerServiceConfig is a service config that sets the default balancer // to the consistent-hashring balancer BalancerServiceConfig = `{"loadBalancingPolicy":"consistent-hashring"}` // CtxKey is the key for the grpc request's context.Context which points to // the key to hash for the request. The value it points to must be []byte CtxKey ctxKey = "requestKey" )
Variables ¶
This section is empty.
Functions ¶
func NewConsistentHashringBuilder ¶
func NewConsistentHashringBuilder(pickerBuilder base.PickerBuilder) balancer.Builder
NewConsistentHashringBuilder creates a new balancer.Builder that will create a consistent hashring balancer with the picker builder. Before making a connection, register it with grpc with: `balancer.Register(consistent.NewConsistentHashringBuilder(hasher, factor, spread))`
Types ¶
type ConsistentHashringPickerBuilder ¶ added in v1.20.0
type ConsistentHashringPickerBuilder struct {
sync.Mutex
// contains filtered or unexported fields
}
ConsistentHashringPickerBuilder is an implementation of base.PickerBuilder and is used to build pickers based on updates to the node architecture.
func NewConsistentHashringPickerBuilder ¶ added in v1.20.0
func NewConsistentHashringPickerBuilder( hasher consistent.HasherFunc, initialReplicationFactor uint16, spread uint8, ) *ConsistentHashringPickerBuilder
NewConsistentHashringPickerBuilder creates a new picker builder that will create consistent hashrings according to the supplied config. If the ReplicationFactor is changed, that new parameter will be used when the next picker is created.
func (*ConsistentHashringPickerBuilder) Build ¶ added in v1.20.0
func (b *ConsistentHashringPickerBuilder) Build(info base.PickerBuildInfo) balancer.Picker
func (*ConsistentHashringPickerBuilder) MarshalZerologObject ¶ added in v1.20.0
func (b *ConsistentHashringPickerBuilder) MarshalZerologObject(e *zerolog.Event)
func (*ConsistentHashringPickerBuilder) MustReplicationFactor ¶ added in v1.20.0
func (b *ConsistentHashringPickerBuilder) MustReplicationFactor(rf uint16)
func (*ConsistentHashringPickerBuilder) MustSpread ¶ added in v1.20.0
func (b *ConsistentHashringPickerBuilder) MustSpread(spread uint8)
Click to show internal directories.
Click to hide internal directories.