RegisterDiscover

package
v3.1.0-rc.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscoverEvent

type DiscoverEvent struct {
	Err    error
	Key    string
	Server []string
	Nodes  []string
}

DiscoverEvent if servers chenged, will create a discover event

type RegDiscover

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

RegDiscover is data struct of register-discover

func NewRegDiscover

func NewRegDiscover(serv string) *RegDiscover

NewRegDiscover used to create a object of RegDiscover

func NewRegDiscoverEx

func NewRegDiscoverEx(serv string, timeOut time.Duration) *RegDiscover

NewRegDiscoverEx used to create a object of RegDiscover

func (*RegDiscover) DiscoverService

func (rd *RegDiscover) DiscoverService(key string) (<-chan *DiscoverEvent, error)

DiscoverService used to discover the service that registered in `key`

func (*RegDiscover) GetServNodes

func (rd *RegDiscover) GetServNodes(key string) ([]string, error)

func (*RegDiscover) Ping

func (cc *RegDiscover) Ping() error

Ping to ping server

func (*RegDiscover) RegisterAndWatchService

func (rd *RegDiscover) RegisterAndWatchService(key string, data []byte) error

RegisterAndWatchService register service info into register-discover platform and then watch the service info, if not exist, then register again key is the index of registered service data is the service information

func (*RegDiscover) Start

func (rd *RegDiscover) Start() error

Start the register and discover service

func (*RegDiscover) Stop

func (rd *RegDiscover) Stop() error

Stop the register and discover service

type RegDiscvServer

type RegDiscvServer interface {
	// Ping to ping server
	Ping() error
	// start the register and discover service
	Start() error
	// stop the register and discover service
	Stop() error
	// RegisterAndWatch register server info into registe-discover service platform, and watch the info, if not exist, then register again
	RegisterAndWatch(key string, data []byte) error
	// GetServNodes get server nodes
	GetServNodes(key string) ([]string, error)
	// discover server from the registe-discover service platform
	Discover(key string) (<-chan *DiscoverEvent, error)
}

RegDiscvServer define the register and discover function interface

type ZkRegDiscv

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

ZkRegDiscv do register and discover by zookeeper

func NewZkRegDiscv

func NewZkRegDiscv(serv string, timeOut time.Duration) *ZkRegDiscv

NewZkRegDiscv create a object of ZkRegDiscv

func (*ZkRegDiscv) Discover

func (zkRD *ZkRegDiscv) Discover(path string) (<-chan *DiscoverEvent, error)

Discover watch the children

func (*ZkRegDiscv) GetServNodes

func (zkRD *ZkRegDiscv) GetServNodes(path string) ([]string, error)

GetServNodes get server nodes by path

func (*ZkRegDiscv) Ping

func (zkRD *ZkRegDiscv) Ping() error

Ping to ping server

func (*ZkRegDiscv) RegisterAndWatch

func (zkRD *ZkRegDiscv) RegisterAndWatch(path string, data []byte) error

RegisterAndWatch create ephemeral node for the service and watch it. if it exit, register again

func (*ZkRegDiscv) Start

func (zkRD *ZkRegDiscv) Start() error

Start used to run register and discover server

func (*ZkRegDiscv) Stop

func (zkRD *ZkRegDiscv) Stop() error

Stop used to stop register and discover server

Jump to

Keyboard shortcuts

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