discover

package
v0.0.0-...-a3a5c94 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 15 Imported by: 0

README

Data center internal service discovery package

Based on ETCD implementation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback interface {
	UpdateEndpoints(endpoints ...*config.Endpoint)
	//when watch occurred error,will exec this method
	Error(error)
}

Callback - Return all nodes every time

type CallbackUpdate

type CallbackUpdate interface {
	//TODO:
	//The automatic discovery of changes is temporarily disabled
	UpdateEndpoints(operation config.Operation, endpoints ...*config.Endpoint)
	//when watch occurred error,will exec this method
	Error(error)
}

CallbackUpdate - Change every time

type Discover

type Discover interface {
	AddProject(name string, callback Callback)
	AddUpdateProject(name string, callback CallbackUpdate)
	Stop()
}

Discover - Automatic discovery of back-end services

func GetDiscover

func GetDiscover(opt config.DiscoverConfig) (Discover, error)

GetDiscover - Get the service discovery manager

type KeepAlive

type KeepAlive struct {
	EtcdClentArgs *etcdutil.ClientArgs
	ServerName    string
	HostName      string
	Endpoint      string
	TTL           int64
	LID           clientv3.LeaseID
	Done          chan struct{}
	// contains filtered or unexported fields
}

KeepAlive - Service registration

func CreateKeepAlive

func CreateKeepAlive(etcdClientArgs *etcdutil.ClientArgs, serverName string, hostName string, HostIP string, Port int) (*KeepAlive, error)

CreateKeepAlive - create keepalive for server

func (*KeepAlive) Start

func (k *KeepAlive) Start() error

Start

func (*KeepAlive) Stop

func (k *KeepAlive) Stop() error

Stop

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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