package internal

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

Package internal contains functions/structs shared by xds balancers/resolvers.

Index

Variables

var ResourceTypeMapForTesting map[string]any

ResourceTypeMapForTesting maps TypeUrl to corresponding ResourceType.

var UnknownCSMLabels = map[string]string{
	"csm.service_name":           "unknown",
	"csm.service_namespace_name": "unknown",
}

UnknownCSMLabels are TelemetryLabels emitted from CDS if CSM Telemetry Label data is not present in the CDS Resource.

Functions

func SetLocalityID

func SetLocalityID(addr resolver.Address, l LocalityID) resolver.Address

SetLocalityID sets locality ID in addr to l.

func SetLocalityIDInEndpoint

func SetLocalityIDInEndpoint(endpoint resolver.Endpoint, l LocalityID) resolver.Endpoint

SetLocalityIDInEndpoint sets locality ID in endpoint to l.

Types

type LocalityID

type LocalityID struct {
	Region  string `json:"region,omitempty"`
	Zone    string `json:"zone,omitempty"`
	SubZone string `json:"subZone,omitempty"`
}

LocalityID is xds.Locality without XXX fields, so it can be used as map keys.

xds.Locality cannot be map keys because one of the XXX fields is a slice.

func GetLocalityID

func GetLocalityID(addr resolver.Address) LocalityID

GetLocalityID returns the locality ID of addr.

func LocalityIDFromString

func LocalityIDFromString(s string) (ret LocalityID, _ error)

LocalityIDFromString converts a json representation of locality, into a LocalityID struct.

func (LocalityID) Empty

func (l LocalityID) Empty() bool

Empty returns whether or not the locality ID is empty.

func (LocalityID) Equal

func (l LocalityID) Equal(o any) bool

Equal allows the values to be compared by Attributes.Equal.

func (LocalityID) ToString

func (l LocalityID) ToString() (string, error)

ToString generates a string representation of LocalityID by marshalling it into json. Not calling it String() so printf won't call it.

Source Files

internal.go

Directories

PathSynopsis
xds/internal/balancerPackage balancer installs all the xds balancers.
xds/internal/balancer/cdsbalancerPackage cdsbalancer implements a balancer to handle CDS responses.
xds/internal/balancer/clusterimplPackage clusterimpl implements the xds_cluster_impl balancing policy.
xds/internal/balancer/clusterimpl/tests
xds/internal/balancer/clustermanagerPackage clustermanager implements the cluster manager LB policy for xds.
xds/internal/balancer/clustermanager/e2e_test
xds/internal/balancer/clusterresolverPackage clusterresolver contains the implementation of the cluster_resolver_experimental LB policy which resolves endpoint addresses using a list of one or more discovery mechanisms.
xds/internal/balancer/clusterresolver/e2e_test
xds/internal/balancer/loadstorePackage loadstore contains the loadStoreWrapper shared by the balancers.
xds/internal/balancer/outlierdetectionPackage outlierdetection provides an implementation of the outlier detection LB policy, as defined in https://github.com/grpc/proposal/blob/master/A50-xds-outlier-detection.md.
xds/internal/balancer/outlierdetection/e2e_test
xds/internal/balancer/priorityPackage priority implements the priority balancer.
xds/internal/balancer/ringhashPackage ringhash implements the ringhash balancer.
xds/internal/balancer/ringhash/e2e
xds/internal/balancer/wrrlocalityPackage wrrlocality provides an implementation of the wrr locality LB policy, as defined in [A52 - xDS Custom LB Policies].
xds/internal/clusterspecifierPackage clusterspecifier contains the ClusterSpecifier interface and a registry for storing and retrieving their implementations.
xds/internal/clusterspecifier/rlsPackage rls implements the RLS cluster specifier plugin.
xds/internal/httpfilterPackage httpfilter contains the HTTPFilter interface and a registry for storing and retrieving their implementations.
xds/internal/httpfilter/faultPackage fault implements the Envoy Fault Injection HTTP filter.
xds/internal/httpfilter/rbacPackage rbac implements the Envoy RBAC HTTP filter.
xds/internal/httpfilter/routerPackage router implements the Envoy Router HTTP filter.
xds/internal/resolverPackage resolver implements the xds resolver, that does LDS and RDS to find the cluster to use.
xds/internal/resolver/internalPackage internal contains functionality internal to the xDS resolver.
xds/internal/serverPackage server contains internal server-side functionality used by the public facing xds package.
xds/internal/test
xds/internal/test/e2ePackage e2e implements xds e2e tests using go-control-plane.
xds/internal/testutilsPackage testutils provides utility types, for use in xds tests.
xds/internal/testutils/fakeclientPackage fakeclient provides a fake implementation of an xDS client.
xds/internal/xdsclientPackage xdsclient implements a full fledged gRPC client for the xDS API used by the xds resolver and balancer implementations.
xds/internal/xdsclient/internalPackage internal contains functionality internal to the xdsclient package.
xds/internal/xdsclient/loadPackage load provides functionality to record and maintain load data.
xds/internal/xdsclient/tests
xds/internal/xdsclient/transportPackage transport defines the interface that describe the functionality required to communicate with an xDS server using streaming calls.
xds/internal/xdsclient/transport/adsPackage ads provides the implementation of an ADS (Aggregated Discovery Service) stream for the xDS client.
xds/internal/xdsclient/transport/grpctransportPackage grpctransport provides an implementation of the transport interface using gRPC.
xds/internal/xdsclient/transport/lrsPackage lrs provides the implementation of an LRS (Load Reporting Service) stream for the xDS client.
xds/internal/xdsclient/xdslbregistryPackage xdslbregistry provides a registry of converters that convert proto from load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
xds/internal/xdsclient/xdslbregistry/converterPackage converter provides converters to convert proto load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
xds/internal/xdsclient/xdsresourcePackage xdsresource implements the xDS data model layer.
xds/internal/xdsclient/xdsresource/tests
xds/internal/xdsclient/xdsresource/versionPackage version defines constants to distinguish between supported xDS API versions.
Version
v1.70.0 (latest)
Published
Jan 23, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
17 hours ago

Tools for package owners.