package loadstore

import "google.golang.org/grpc/xds/internal/balancer/loadstore"

Package loadstore contains the loadStoreWrapper shared by the balancers.

Index

Types

type Wrapper

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

Wrapper wraps a load store with cluster and edsService.

It's store and cluster/edsService can be updated separately. And it will update its internal perCluster store so that new stats will be added to the correct perCluster.

Note that this struct is a temporary workaround before we implement graceful switch for EDS. Any update to the clusterName and serviceName is too early, the perfect timing is when the picker is updated with the new connection. This early update could cause picks for the old SubConn being reported to the new services.

When the graceful switch in EDS is done, there should be no need for this struct. The policies that record/report load shouldn't need to handle update of lrsServerName/cluster/edsService. Its parent should do a graceful switch of the whole tree when one of that changes.

func NewWrapper

func NewWrapper() *Wrapper

NewWrapper creates a Wrapper.

func (*Wrapper) CallDropped

func (lsw *Wrapper) CallDropped(category string)

CallDropped records a call dropped in the store.

func (*Wrapper) CallFinished

func (lsw *Wrapper) CallFinished(locality string, err error)

CallFinished records a call finished in the store.

func (*Wrapper) CallServerLoad

func (lsw *Wrapper) CallServerLoad(locality, name string, val float64)

CallServerLoad records the server load in the store.

func (*Wrapper) CallStarted

func (lsw *Wrapper) CallStarted(locality string)

CallStarted records a call started in the store.

func (*Wrapper) UpdateClusterAndService

func (lsw *Wrapper) UpdateClusterAndService(cluster, edsService string)

UpdateClusterAndService updates the cluster name and eds service for this wrapper. If any one of them is changed from before, the perCluster store in this wrapper will also be updated.

func (*Wrapper) UpdateLoadStore

func (lsw *Wrapper) UpdateLoadStore(store *load.Store)

UpdateLoadStore updates the load store for this wrapper. If it is changed from before, the perCluster store in this wrapper will also be updated.

Source Files

load_store_wrapper.go

Version
v1.70.0 (latest)
Published
Jan 23, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
8 minutes ago

Tools for package owners.