client

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 36 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

	UnaryOptions  UnaryOptions
	StreamOptions StreamOptions

	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

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

	// GRPC
	GRPCConnPoolSize uint32
	GRPCConnectOpts  *grpc.ConnectOptions

	// TTHeaderStreaming
	TTHeaderStreamingOptions TTHeaderStreamingOptions

	// XDS
	XDSEnabled          bool
	XDSRouterMiddleware endpoint.Middleware

	// Context backup
	CtxBackupHandler backup.BackupHandler

	Streaming stream.StreamingConfig // deprecated, use StreamOptions instead

	// TailOptions is used to store options that are executed after all options are applied.
	// just ignore it unless you clearly know what you are doing.
	TailOptions []Option
}

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

type StreamOption added in v0.13.0

type StreamOption struct {
	F func(o *StreamOptions, di *utils.Slice)
}

type StreamOptions added in v0.13.0

type StreamOptions struct {
	EventHandler                 stream.StreamEventHandler
	RecvTimeout                  time.Duration
	StreamMiddlewares            []cep.StreamMiddleware
	StreamMiddlewareBuilders     []cep.StreamMiddlewareBuilder
	StreamRecvMiddlewares        []cep.StreamRecvMiddleware
	StreamRecvMiddlewareBuilders []cep.StreamRecvMiddlewareBuilder
	StreamSendMiddlewares        []cep.StreamSendMiddleware
	StreamSendMiddlewareBuilders []cep.StreamSendMiddlewareBuilder
}

func (*StreamOptions) BuildRecvChain added in v0.13.0

func (o *StreamOptions) BuildRecvChain(recvEndpoint cep.StreamRecvEndpoint) cep.StreamRecvEndpoint

func (*StreamOptions) BuildSendChain added in v0.13.0

func (o *StreamOptions) BuildSendChain(sendEndpoint cep.StreamSendEndpoint) cep.StreamSendEndpoint

func (*StreamOptions) InitMiddlewares added in v0.13.0

func (o *StreamOptions) InitMiddlewares(ctx context.Context)

type TTHeaderStreamingOption added in v0.13.0

type TTHeaderStreamingOption struct {
	F func(o *TTHeaderStreamingOptions, di *utils.Slice)
}

type TTHeaderStreamingOptions added in v0.13.0

type TTHeaderStreamingOptions struct {
	TransportOptions []ttstream.ClientProviderOption
}

type UnaryOption added in v0.13.0

type UnaryOption struct {
	F func(o *UnaryOptions, di *utils.Slice)
}

type UnaryOptions added in v0.13.0

type UnaryOptions struct {

	// middlewares
	UnaryMiddlewares        []endpoint.UnaryMiddleware
	UnaryMiddlewareBuilders []endpoint.UnaryMiddlewareBuilder

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

	// fallback policy
	Fallback *fallback.Policy
	// contains filtered or unexported fields
}

func (*UnaryOptions) InitMiddlewares added in v0.13.0

func (o *UnaryOptions) InitMiddlewares(ctx context.Context)

func (*UnaryOptions) SetUnaryRPCTimeout added in v0.13.0

func (o *UnaryOptions) SetUnaryRPCTimeout(d time.Duration)

Jump to

Keyboard shortcuts

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