discov

package
v0.0.0-...-d4bbc0e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {
	// 服务发现名字 eg etcd zk consul
	Name() string
	// 注册服务
	Register(ctx context.Context, service *Service)
	// 取消注册服务
	UnRegister(ctx context.Context, service *Service)
	// 获取服务节点信息
	GetService(ctx context.Context, name string) *Service
	// 增加监听者
	AddListener(ctx context.Context, f func())
	// 通知所有的监听者
	NotifyListeners()
}

type Endpoint

type Endpoint struct {
	ServiceName string `json:"server_name"`
	IP          string `json:"ip"`
	Port        int    `json:"port"`
	Weight      int    `json:"weight"`
	Enable      bool   `json:"enable"`
}

type Service

type Service struct {
	Name      string      `json:"name"`
	Endpoints []*Endpoint `json:"endpoints"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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