client

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package client defines the Options of client

Package client defines the Options about remote transport of client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigLocks

type ConfigLocks struct {
	Bits int
	Tags map[string]struct{}
}

ConfigLocks records changing made by options that are not allowed further modifications.

func NewConfigLocks

func NewConfigLocks() *ConfigLocks

NewConfigLocks creates a ConfigLocks.

func (*ConfigLocks) ApplyLocks

func (cl *ConfigLocks) ApplyLocks(cfg rpcinfo.MutableRPCConfig, svr remoteinfo.RemoteInfo)

ApplyLocks applies the locking operations on rpcinfo.RPCConfig and internal.RemoteInfo.

func (*ConfigLocks) Merge

func (cl *ConfigLocks) Merge(c2 *ConfigLocks)

Merge merges another ConfigLocks into the current one.

func (*ConfigLocks) Zero

func (cl *ConfigLocks) Zero()

Zero ConfigLocks clear

type Option

type Option struct {
	F func(o *Options, di *utils.Slice)
}

Option is the only way to config client.

type Options

type Options struct {
	Cli     *rpcinfo.EndpointBasicInfo
	Svr     *rpcinfo.EndpointBasicInfo
	Configs rpcinfo.RPCConfig
	Locks   *ConfigLocks
	Once    *configutil.OptionOnce

	MetaHandlers []remote.MetaHandler

	RemoteOpt        *remote.ClientOption
	Proxy            proxy.ForwardProxy
	Resolver         discovery.Resolver
	HTTPResolver     http.Resolver
	Balancer         loadbalance.Loadbalancer
	BalancerCacheOpt *lbcache.Options
	PoolCfg          *connpool2.IdleConfig
	ErrHandle        func(context.Context, error) error
	Targets          string
	CBSuite          *circuitbreak.CBSuite
	Timeouts         rpcinfo.TimeoutProvider

	ACLRules []acl.RejectFunc

	MWBs  []endpoint.MiddlewareBuilder
	IMWBs []endpoint.MiddlewareBuilder

	Bus          event.Bus
	Events       event.Queue
	ExtraTimeout time.Duration

	// DebugInfo should only contain objects that are suitable for json serialization.
	DebugInfo    utils.Slice
	DebugService diagnosis.Service

	// Observability
	TracerCtl  *rpcinfo.TraceController
	StatsLevel *stats.Level

	// retry policy
	RetryMethodPolicies map[string]retry.Policy
	RetryContainer      *retry.Container
	RetryWithResult     *retry.ShouldResultRetry

	// fallback policy
	Fallback *fallback.Policy

	CloseCallbacks []func() error
	WarmUpOption   *warmup.ClientOption

	// GRPC
	GRPCConnPoolSize uint32
	GRPCConnectOpts  *grpc.ConnectOptions

	// XDS
	XDSEnabled          bool
	XDSRouterMiddleware endpoint.Middleware

	// Context backup
	CtxBackupHandler backup.BackupHandler

	Streaming stream.StreamingConfig
}

Options is used to initialize a client.

func NewOptions

func NewOptions(opts []Option) *Options

NewOptions creates a new option.

func (*Options) Apply

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

Apply applies all options.

func (*Options) InitRetryContainer added in v0.9.0

func (o *Options) InitRetryContainer()

InitRetryContainer init retry container and add close callback

Jump to

Keyboard shortcuts

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