balancer

package
v0.0.0-...-037b315 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Mix        = "mix"        // consistent 和 其他注册balancer算法 的混合体
	Consistent = "consistent" //一致性hash
)

Variables

This section is empty.

Functions

func FromNameContext

func FromNameContext(ctx context.Context) (string, bool)

func FromParamContext

func FromParamContext(ctx context.Context) (string, bool)

func FromTargetContext

func FromTargetContext(ctx context.Context) (string, bool)

func NewNameContext

func NewNameContext(ctx context.Context, name string) context.Context

NewNameContext 设置balance负载的名字, mix负载会根据该名字选择其他balance

func NewParamContext

func NewParamContext(ctx context.Context, addr string) context.Context

NewParamContext 用于balance负载的参数

func NewTargetContext

func NewTargetContext(ctx context.Context, name string) context.Context

NewTargetContext 设置target目标服务的名字

func RegisterPicker

func RegisterPicker(builder Picker)

Types

type Matcher

type Matcher interface {
	Match(ctx context.Context) bool
}

type Picker

type Picker interface {
	Matcher
	base.PickerBuilder
	balancer.Picker
	Name() string
}

type PickerBuildInfoString

type PickerBuildInfoString base.PickerBuildInfo

func (PickerBuildInfoString) String

func (p PickerBuildInfoString) String() string

Jump to

Keyboard shortcuts

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