package ringhash

import "google.golang.org/grpc/internal/ringhash"

Package ringhash (internal) contains functions and types that need to be shared by the ring hash balancer and other gRPC code (such as xDS) without being exported.

Index

Functions

func SetXDSRequestHash

func SetXDSRequestHash(ctx context.Context, requestHash uint64) context.Context

SetXDSRequestHash adds the request hash to the context for use in Ring Hash Load Balancing using xDS route hash_policy.

func XDSRequestHash

func XDSRequestHash(ctx context.Context) (uint64, bool)

XDSRequestHash returns the request hash in the context and true if it was set from the xDS config selector. If the xDS config selector has not set the hash, it returns 0 and false.

Types

type LBConfig

type LBConfig struct {
	serviceconfig.LoadBalancingConfig `json:"-"`

	MinRingSize       uint64 `json:"minRingSize,omitempty"`
	MaxRingSize       uint64 `json:"maxRingSize,omitempty"`
	RequestHashHeader string `json:"requestHashHeader,omitempty"`
}

LBConfig is the balancer config for ring_hash balancer.

Source Files

ringhash.go

Version
v1.74.0-dev
Published
May 15, 2025
Platform
js/wasm
Imports
2 packages
Last checked
43 seconds ago

Tools for package owners.