cluster

package
v0.0.0-...-1369677 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deregister

func Deregister(node *Node) error

func Init

func Init(service string)

func InitClusterConfig

func InitClusterConfig() error

func Register

func Register(node *Node, ttl int) error

Register 节点管理--Register注册节点,DeRegister注销节点,Discover发现节点

func WatchClusterConfig

func WatchClusterConfig() error

Types

type Config

type Config struct {
	LogLevel  string `json:"logLevel"` // 日志等级
	RateLimit struct {
		Middle int `json:"middle"` // 中间层限流
		Low    int `json:"low"`    // 底层限流
	} `json:"rateLimit"` // 限流器配置
	CircuitBreaker struct {
		Cpu     int `json:"cpu"`     // cpu使用率配置
		Latency int `json:"latency"` // 请求延时,单位ms
	} `json:"circuitBreaker"` // 熔断器配置
	RedisDB struct {
		Lock  int `json:"lock"`  // 锁使用db
		Cron  int `json:"cron"`  // 定时任务使用db
		Rank  int `json:"rank"`  // 排行榜使用db
		Cache int `json:"cache"` // 缓存使用db
	} `json:"redisDb"` // redis db
}

func GetClusterConfig

func GetClusterConfig() Config

type Node

type Node struct {
	Addr    string `json:"addr"`    // 节点服务地址
	Version string `json:"version"` // 节点服务版本
	Proto   string `json:"proto"`   // 协议
}

func Discover

func Discover() (output []*Node, err error)

Jump to

Keyboard shortcuts

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