discovery

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node added in v0.2.0

type Node struct {
	DC      string
	Service string
	NID     string
	IP      string
}

Node represents a node info

func (*Node) ID added in v0.2.0

func (n *Node) ID() string

ID return the node id with scheme prefix

type Service added in v1.5.0

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

Service represents a service node

func NewService added in v1.5.0

func NewService(service string, dc string, addrs []string) (*Service, error)

NewService create a service instance

func (*Service) Close added in v1.5.0

func (s *Service) Close()

Close service

func (*Service) GetNodes added in v1.5.0

func (s *Service) GetNodes(service string, nodes map[string]Node) error

GetNodes get the service nodes

func (*Service) KeepAlive added in v1.5.0

func (s *Service) KeepAlive()

KeepAlive service keepalive

func (*Service) NID added in v1.5.0

func (s *Service) NID() string

NID return node id

func (*Service) Watch added in v1.5.0

func (s *Service) Watch(service string, onStateChange func(state State, id string, node *Node))

Watch the service nodes

type State added in v1.5.0

type State int32

State define the node state type

const (
	// NodeUp node starting up
	NodeUp State = 0
	// NodeDown node shutdown
	NodeDown State = 1
)

Jump to

Keyboard shortcuts

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