xclient

package
v0.0.0-...-6674cbf Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {
	Refresh() error                // 刷新服务列表
	Update(servers []string) error // 更新服务列表
	Get(mode SelectMode) (string, error)
	GetAll() ([]string, error)
}

type MultiServersDiscovery

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

func NewMultiServerDiscovery

func NewMultiServerDiscovery(servers []string) *MultiServersDiscovery

func (*MultiServersDiscovery) Get

func (d *MultiServersDiscovery) Get(mode SelectMode) (string, error)

func (*MultiServersDiscovery) GetAll

func (d *MultiServersDiscovery) GetAll() ([]string, error)

func (*MultiServersDiscovery) Refresh

func (d *MultiServersDiscovery) Refresh() error

func (*MultiServersDiscovery) Update

func (d *MultiServersDiscovery) Update(servers []string) error

type SelectMode

type SelectMode int
const (
	RandomSelect SelectMode = iota
	RoundRobinSelect
)

type XClient

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

func NewXClient

func NewXClient(d Discovery, mode SelectMode, opt *rpc.Option) *XClient

func (*XClient) Broadcast

func (c *XClient) Broadcast(ctx context.Context, serviceMethod string, args, reply any) error

func (*XClient) Call

func (c *XClient) Call(ctx context.Context, serviceMethod string, args, reply any) error

func (*XClient) Close

func (c *XClient) Close() error

func (*XClient) Go

func (c *XClient) Go(serviceMethod string, args, reply any, done chan *rpc.Call) *rpc.Call

Jump to

Keyboard shortcuts

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