clientproxy

package
v0.0.0-...-f683eec Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallProxyOptionsWatchDog

func InstallProxyOptionsWatchDog(dog func(cc *ProxyOptions))

InstallProxyOptionsWatchDog install watch dog

Types

type Client

type Client = network.Client

type ClientProxy

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

ClientProxy client wrap

func NewClientProxy

func NewClientProxy(path string, opt ...ProxyOption) (proxy *ClientProxy, err error)

func (*ClientProxy) AsyncCall

func (c *ClientProxy) AsyncCall(ctx context.Context, uri interface{}, rq interface{}, af process.RouterFunc, opts *rpc.AsyncCallOptions) (err error)

func (*ClientProxy) Call

func (c *ClientProxy) Call(ctx context.Context, uri interface{}, rq, rs interface{}, opts *rpc.CallOptions) (err error)

func (*ClientProxy) Close

func (c *ClientProxy) Close(ctx context.Context)

func (*ClientProxy) InitProxy

func (c *ClientProxy) InitProxy(ctx context.Context) (err error)

func (*ClientProxy) Notify

func (c *ClientProxy) Notify(ctx context.Context, uri interface{}, rq interface{}, opts *rpc.NoticeOptions) (err error)

type LinkMode

type LinkMode int8
const (
	LinkModeImmediately LinkMode = iota
	LinkModeDelay
)

type NewClientFunc

type NewClientFunc func(netwrok, addr string, inner *process.InnerOptions) (cli Client, err error)

NewClientFunc new client func. inner use for custom client

type NewDiscoveryFunc

type NewDiscoveryFunc func(path string, opts ...discovery.DiscoveryOption) (_ discovery.Discovery, err error)

type ProxyOption

type ProxyOption func(cc *ProxyOptions) ProxyOption

ProxyOption option define

func WithAsyncLink(v bool) ProxyOption

AsyncLink client async link server

func WithDiscoveryOptions

func WithDiscoveryOptions(v ...discovery.DiscoveryOption) ProxyOption

DiscoveryOptions custom discovery options

func WithFrameLogger

func WithFrameLogger(v *zaplog.Logger) ProxyOption

frame log

func WithLinkInterval

func WithLinkInterval(v time.Duration) ProxyOption

LinkInterval

func WithLinkMode

func WithLinkMode(v LinkMode) ProxyOption

LinkMode immediately or delay link

func WithNewClient

func WithNewClient(v NewClientFunc) ProxyOption

NewEntry create custom entry for discovery new entry

func WithNewDiscovery

func WithNewDiscovery(v NewDiscoveryFunc) ProxyOption

NewDiscovery create discovery

func WithPickerBuilder

func WithPickerBuilder(v balancer.PickerBuilder) ProxyOption

BalancerName specify default balancer. empty means use server set value.

func WithUpdateBalanceAfterLink(v bool) ProxyOption

UpdateBalanceAfterLink Whether the link must have been established before notifying the balancer

func WithUseAftreAllLink(v bool) ProxyOption

UseAfterAllLink the first initialization must be fully linked before it can be used

type ProxyOptions

type ProxyOptions struct {
	// NewEntry create custom entry for discovery new entry
	NewClient NewClientFunc
	// DiscoveryOptions custom discovery options
	DiscoveryOptions []discovery.DiscoveryOption
	// NewDiscovery create discovery
	NewDiscovery NewDiscoveryFunc
	// BalancerName specify default balancer. empty means use server set value.
	PickerBuilder balancer.PickerBuilder
	// AsyncLink client async link server
	AsyncLink bool
	// UpdateBalanceAfterLink Whether the link must have been established before notifying the balancer
	UpdateBalanceAfterLink bool
	// LinkMode immediately or delay link
	LinkMode LinkMode
	// UseAfterAllLink the first initialization must be fully linked before it can be used
	UseAftreAllLink bool
	// LinkInterval
	LinkInterval time.Duration
	// frame log
	FrameLogger *zaplog.Logger
}

func NewProxyOptions

func NewProxyOptions(opts ...ProxyOption) *ProxyOptions

NewProxyOptions create options instance.

func (*ProxyOptions) ApplyOption

func (cc *ProxyOptions) ApplyOption(opts ...ProxyOption)

ApplyOption modify options

func (*ProxyOptions) GetSetOption

func (cc *ProxyOptions) GetSetOption(opt ProxyOption) ProxyOption

GetSetOption modify and get last option

func (*ProxyOptions) SetOption

func (cc *ProxyOptions) SetOption(opt ProxyOption)

SetOption modify options

Jump to

Keyboard shortcuts

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