balancer

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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 (*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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL