registrarclient

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEARTBEATOFFSET  = 1
	MAXRETRY         = 2
	DEFAULTLEASETIME = 10
	BufSize          = 10
)
View Source
const (
	DEFAULT_LEASE_TIME = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

func WithFileOption

func WithFileOption(filepath string) ClientOption

func WithLeaseTime

func WithLeaseTime(t int64) ClientOption

func WithPassive

func WithPassive(b bool) ClientOption

func WithRegistrarAddr

func WithRegistrarAddr(addr []string) ClientOption

func WithService

func WithService(name, addr string) ClientOption

type ClientOpts

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

func NewDefaultOptions

func NewDefaultOptions() *ClientOpts

func (*ClientOpts) ApplyOpts

func (opt *ClientOpts) ApplyOpts(option []ClientOption)

func (*ClientOpts) WithLeaseTime added in v0.0.2

func (opt *ClientOpts) WithLeaseTime(leaseTime int64) *ClientOpts

func (*ClientOpts) WithPassive added in v0.0.2

func (opt *ClientOpts) WithPassive(b bool) *ClientOpts

func (*ClientOpts) WithRegistrarAddress added in v0.0.2

func (opt *ClientOpts) WithRegistrarAddress(addr []string) *ClientOpts

func (*ClientOpts) WithService added in v0.0.2

func (opt *ClientOpts) WithService(name string, addr string) *ClientOpts

type RegistrarClient

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

func NewRegistrarClient

func NewRegistrarClient(opts *ClientOpts) *RegistrarClient

func (*RegistrarClient) Close

func (c *RegistrarClient) Close()

TODO new了但没注册

func (*RegistrarClient) Discover

func (c *RegistrarClient) Discover(ctx context.Context, name string) (string, error)

func (*RegistrarClient) Register

func (c *RegistrarClient) Register(ctx context.Context) error

func (*RegistrarClient) Subscribe

func (c *RegistrarClient) Subscribe(ctx context.Context, name string) (chan *pb.SubscribeResponse, error)

Jump to

Keyboard shortcuts

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