key_hash

package
v0.0.0-...-a23f37e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContextKey 这个值用来从context中获取到值
	ContextKey = "Key-hash-key"
)

基于传入值的key的hash的算法: 相同的传入的key分配到相同的node上面 在使用这个算法的时候,需要在传入的context中传入需要的key

Variables

View Source
var (
	NoContextKeyError = errors.New("context not has key ,key str = " + ContextKey)
)

Functions

func NewKeyHashBalancer

func NewKeyHashBalancer() registry.Balancer

Types

type KeyHashBalancer

type KeyHashBalancer struct {
	// contains filtered or unexported fields
}

func (KeyHashBalancer) Pick

func (k KeyHashBalancer) Pick(ctx context.Context, nodes []registry.Node) (selected registry.Node, err error)

Jump to

Keyboard shortcuts

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