discovery

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 added in v0.2.0

func GetEventChannel(node Node) string

GetEventChannel .

func GetRPCChannel added in v0.2.0

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 added in v0.2.0

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

GetResponseByPrefix .

type Node added in v0.2.0

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

Node service node info

type NodeStateType added in v0.2.0

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

type ServiceNode added in v0.2.0

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

ServiceNode .

func NewServiceNode added in v0.2.0

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

NewServiceNode .

func (*ServiceNode) GetEventChannel added in v0.2.0

func (sn *ServiceNode) GetEventChannel() string

GetEventChannel .

func (*ServiceNode) GetRPCChannel added in v0.2.0

func (sn *ServiceNode) GetRPCChannel() string

GetRPCChannel .

func (*ServiceNode) NodeInfo added in v0.2.0

func (sn *ServiceNode) NodeInfo() Node

NodeInfo .

func (*ServiceNode) RegisterNode added in v0.2.0

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

RegisterNode register a new node.

type ServiceRegistry added in v0.2.0

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

ServiceRegistry lib

func NewServiceRegistry added in v0.2.0

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

NewServiceRegistry ServiceRegistry factory method

func (*ServiceRegistry) GetServiceNodes added in v0.2.0

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

GetServiceNodes returns a list of active service nodes

func (*ServiceRegistry) RegisterServiceNode added in v0.2.0

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

RegisterServiceNode .

type ServiceWatchCallback added in v0.2.0

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

ServiceWatchCallback .

type ServiceWatcher added in v0.2.0

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

ServiceWatcher .

func NewServiceWatcher added in v0.2.0

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

NewServiceWatcher .

func (*ServiceWatcher) DeleteNodesByID added in v0.2.0

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

func (*ServiceWatcher) GetNodes added in v0.2.0

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

func (*ServiceWatcher) GetNodesByID added in v0.2.0

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

func (*ServiceWatcher) WatchNode added in v0.2.0

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

func (*ServiceWatcher) WatchServiceNode added in v0.2.0

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