package xdslbregistry

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

Package xdslbregistry provides a registry of converters that convert proto from load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.

Index

Functions

func ConvertToServiceConfig

func ConvertToServiceConfig(lbPolicy *v3clusterpb.LoadBalancingPolicy, depth int) (json.RawMessage, error)

ConvertToServiceConfig converts a proto Load Balancing Policy configuration into a json string. Returns an error if:

func Register

func Register(protoType string, c Converter)

Register registers the converter to the map keyed on a proto type. Must be called at init time. Not thread safe.

func SetRegistry

func SetRegistry(registry map[string]Converter)

SetRegistry sets the xDS LB registry. Must be called at init time. Not thread safe.

Types

type Converter

type Converter func([]byte, int) (json.RawMessage, error)

Converter converts raw proto bytes into the internal Go JSON representation of the proto passed. Returns the json message, and an error. If both returned are nil, it represents continuing to the next proto.

Source Files

xdslbregistry.go

Directories

PathSynopsis
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.
Version
v1.70.0 (latest)
Published
Jan 23, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
17 minutes ago

Tools for package owners.