xdssuite

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// RouterClusterKey picked cluster in rpcInfo tag key
	RouterClusterKey = "XDS_Route_Picked_Cluster"
)

Variables

This section is empty.

Functions

func NewCircuitBreaker added in v0.4.0

func NewCircuitBreaker(opts ...Option) client.Option

NewCircuitBreaker integrate xds config and kitex circuitbreaker

func NewClientOption added in v0.4.1

func NewClientOption(opts ...Option) client.Option

NewClientOption wrapper for NewClientSuite

func NewClientSuite added in v0.4.0

func NewClientSuite(opts ...Option) client.Suite

NewClientSuite client suite for xds handler

func NewLimiter added in v0.4.0

func NewLimiter(opts ...Option) server.Option

NewLimiter creates a server limiter

func NewRetryPolicy added in v0.4.0

func NewRetryPolicy(opts ...Option) client.Option

NewRetryPolicy integrate xds config and kitex circuitbreaker

func NewServerOption added in v0.4.1

func NewServerOption(opts ...Option) server.Option

NewServerOption wrapper for NewServerSuite.

func NewServerSuite added in v0.4.0

func NewServerSuite(opts ...Option) server.Suite

NewServerSuite server suite for xds handler

func NewXDSRouterMiddleware

func NewXDSRouterMiddleware(opts ...Option) endpoint.Middleware

NewXDSRouterMiddleware creates a middleware for request routing via XDS. This middleware picks one upstream cluster and sets RPCTimeout based on route config retrieved from XDS.

func SetXDSResourceManager

func SetXDSResourceManager(m XDSResourceManager) error

SetXDSResourceManager builds the XDSResourceManager using the input function.

func XDSInited

func XDSInited() bool

Types

type Option

type Option struct {
	F func(o *Options)
}

func WithMatchRetryMethod added in v0.4.1

func WithMatchRetryMethod(match bool) Option

WithMatchRetryMethod configures the flag of matchRetryMethod

func WithRouterMetaExtractor

func WithRouterMetaExtractor(routerMetaExtractor routerMetaExtractor) Option

WithRouterMetaExtractor configures the extractor for metadata

func WithServiceCircuitBreak added in v0.4.1

func WithServiceCircuitBreak(enable bool) Option

WithServiceCircuitBreak if enable service dimension circuitbreak

func WithServicePort added in v0.4.1

func WithServicePort(port uint32) Option

WithServicePort configures the service port, used for rate limit.

type Options

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

Options for xds suite

func NewOptions

func NewOptions(opts []Option) *Options

func (*Options) Apply

func (o *Options) Apply(opts []Option)

type RouteResult

type RouteResult struct {
	RPCTimeout    time.Duration
	ClusterPicked string
}

RouteResult stores the result of route

type XDSResolver

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

XDSResolver uses xdsResourceManager to get endpoints.

func NewXDSResolver

func NewXDSResolver() *XDSResolver

func (*XDSResolver) Diff

func (r *XDSResolver) Diff(cacheKey string, prev, next discovery.Result) (discovery.Change, bool)

Diff implements the Resolver interface. Use DefaultDiff.

func (*XDSResolver) Name

func (r *XDSResolver) Name() string

Name returns the name of the resolver.

func (*XDSResolver) Resolve

func (r *XDSResolver) Resolve(ctx context.Context, desc string) (discovery.Result, error)

Resolve returns a list of instances for the given description of a target.

func (*XDSResolver) Target

func (r *XDSResolver) Target(ctx context.Context, target rpcinfo.EndpointInfo) (description string)

Target should return a description for the given target that is suitable for being a key for cache.

type XDSResourceManager

type XDSResourceManager interface {
	Get(ctx context.Context, resourceType xdsresource.ResourceType, resourceName string) (interface{}, error)
	// RegisterXDSUpdateHandler registers the callback function for the specified resource
	RegisterXDSUpdateHandler(resourceType xdsresource.ResourceType, handler xdsresource.XDSUpdateHandler)
}

XDSResourceManager is the interface for the xds resource manager. Get() returns the resources according to the input resourceType and resourceName. Get() returns error when the fetching fails or the resource is not found in the latest update.

type XDSRouter

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

XDSRouter is a router that uses xds to route the rpc call

func NewXDSRouter

func NewXDSRouter(opts ...Option) *XDSRouter

func (*XDSRouter) Route

func (r *XDSRouter) Route(ctx context.Context, ri rpcinfo.RPCInfo) (*RouteResult, error)

Route routes the rpc call to a cluster based on the RPCInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL