etcd

package
v0.0.0-...-21ca16f Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: LGPL-2.1 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Interval         = 3
	DefaultLeaseTime = 10
	Heartbeat        = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalNode

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

func (*LocalNode) Keep

func (l *LocalNode) Keep(interval int64)

type NodeInfo

type NodeInfo struct {
	Addr    string      `json:"addr"`
	SvrID   string      `json:"svr_id"`
	SvrName string      `json:"svr_name"`
	Weight  int         `json:"weight"`
	Config  interface{} `json:"config"`
}

type Option

type Option func(info *NodeInfo)

func SetWeight

func SetWeight(weight int) Option

type RegPool

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

type Register

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

func NewRegister

func NewRegister(client *clientv3.Client, prefix string) *Register

func (*Register) CloseWatch

func (r *Register) CloseWatch()

func (*Register) GetAll

func (r *Register) GetAll() map[string]NodeInfo

func (*Register) GetNode

func (r *Register) GetNode(svrName string) (*NodeInfo, error)

func (*Register) GetOptimalNodeItem

func (r *Register) GetOptimalNodeItem() (nodeInfo NodeInfo, ok bool)

func (*Register) LocalNode

func (r *Register) LocalNode(node *NodeInfo) error

func (*Register) NodeUpdateConfiguration

func (r *Register) NodeUpdateConfiguration(config interface{}, opt ...Option) error

func (*Register) OpenWatch

func (r *Register) OpenWatch() *Register

Jump to

Keyboard shortcuts

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