Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

endpointsharding

v1.85.0
google.golang.org/grpc/balancer/endpointsharding

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

8 matches

Top ↑

Package endpointsharding implements a load balancing policy that manages homogeneous child policies each owning a single endpoint.

Experimental

Notice: This package is EXPERIMENTAL and may be changed or removed in a later release.

Functions

NewBalancer

func NewBalancer(cc balancer.ClientConn, opts balancer.BuildOptions, childBuilder ChildBuilderFunc, esOpts Options) balancer.Balancer

NewBalancer returns a load balancing policy that manages homogeneous child policies each owning a single endpoint. The endpointsharding balancer forwards the LoadBalancingConfig in ClientConn state updates to its children.

Types

ChildBuilderFunc

type ChildBuilderFunc func(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer

ChildBuilderFunc creates a new balancer with the ClientConn. It has the same type as the balancer.Builder.Build method.

ChildState

type ChildState struct {
	Endpoint resolver.Endpoint // Endpoint of the child balancer.
	State    balancer.State    // State of the child balancer.
	ExitIdle func()            // Function to exit the child balancer from IDLE state.
}

ChildState is the state of a child balancer.

ChildStatesFromPicker

func ChildStatesFromPicker(picker balancer.Picker) []ChildState

ChildStatesFromPicker returns the state of all the children managed by the endpoint sharding balancer that created this picker.

Options

type Options struct {
	// DisableAutoReconnect allows the balancer to keep child balancer in the
	// IDLE state until they are explicitly triggered to exit using the
	// ChildState obtained from the endpointsharding picker. When set to false,
	// the endpointsharding balancer will automatically call ExitIdle on child
	// connections that report IDLE.
	DisableAutoReconnect bool
}

Options configure the behaviour of the endpointsharding balancer.

Dependency graph