discovery

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func Del

func Del(key string, prefix bool)

func GetByPrefix

func GetByPrefix(key string) map[string]string

func GetEventChannel

func GetEventChannel(node Node) string

GetEventChannel .

func GetRPCChannel

func GetRPCChannel(node Node) string

GetRPCChannel .

func Init

func Init(etcds []string)

func Keep

func Keep(key, val string)

func UpdateLoad

func UpdateLoad(ip string, port int)

func Watch

func Watch(key string, watchFunc WatchCallback, prefix bool)

Types

type Etcd

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

func (*Etcd) GetResponseByPrefix

func (e *Etcd) GetResponseByPrefix(key string) (*clientv3.GetResponse, error)

GetResponseByPrefix .

type Node

type Node struct {
	ID   string
	Info map[string]string
}

Node service node info

type NodeStateType

type NodeStateType int32
const (
	UP   NodeStateType = 0
	DOWN NodeStateType = 1
)

type ServiceNode

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

ServiceNode .

func NewServiceNode

func NewServiceNode(endpoints []string, dc string) *ServiceNode

NewServiceNode .

func (*ServiceNode) GetEventChannel

func (sn *ServiceNode) GetEventChannel() string

GetEventChannel .

func (*ServiceNode) GetRPCChannel

func (sn *ServiceNode) GetRPCChannel() string

GetRPCChannel .

func (*ServiceNode) NodeInfo

func (sn *ServiceNode) NodeInfo() Node

NodeInfo .

func (*ServiceNode) RegisterNode

func (sn *ServiceNode) RegisterNode(serviceName string, name string)

RegisterNode register a new node.

func (*ServiceNode) UnregisterNode added in v0.3.4

func (sn *ServiceNode) UnregisterNode() error

RegisterNode register a new node.

type ServiceRegistry

type ServiceRegistry struct {
	Scheme string
	// contains filtered or unexported fields
}

ServiceRegistry lib

func NewServiceRegistry

func NewServiceRegistry(endpoints []string, scheme string) *ServiceRegistry

NewServiceRegistry ServiceRegistry factory method

func (*ServiceRegistry) GetServiceNodes

func (r *ServiceRegistry) GetServiceNodes(serviceName string) ([]Node, error)

GetServiceNodes returns a list of active service nodes

func (*ServiceRegistry) RegisterServiceNode

func (r *ServiceRegistry) RegisterServiceNode(serviceName string, node Node) error

RegisterServiceNode .

type ServiceWatchCallback

type ServiceWatchCallback func(service string, state NodeStateType, nodes Node)

ServiceWatchCallback .

type ServiceWatcher

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

ServiceWatcher .

func NewServiceWatcher

func NewServiceWatcher(endpoints []string, dc string) *ServiceWatcher

NewServiceWatcher .

func (*ServiceWatcher) DeleteNodesByID

func (sw *ServiceWatcher) DeleteNodesByID(ID string) bool

func (*ServiceWatcher) GetNodes

func (sw *ServiceWatcher) GetNodes(service string) (map[string]Node, bool)

func (*ServiceWatcher) GetNodesByID

func (sw *ServiceWatcher) GetNodesByID(ID string) (*Node, bool)

func (*ServiceWatcher) WatchNode

func (sw *ServiceWatcher) WatchNode(ch clientv3.WatchChan)

func (*ServiceWatcher) WatchServiceNode

func (sw *ServiceWatcher) WatchServiceNode(serviceName string, callback ServiceWatchCallback)

WatchServiceNode .

type WatchCallback

type WatchCallback func(clientv3.WatchChan)

Jump to

Keyboard shortcuts

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