discovery

package
v0.0.0-...-3ee03de Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 9 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 {
	Discovery(serName string) ([]*Server, error)
	Registry(serName, addr string, weights float64, protocol transport.Protocol, maximumLoad int64, serID *string) error
	UnRegistry(serName string, serID string) error
	Limit() bool // 是否开启限流 Whether to limit the flow
	Add(load int64)
	Less(load int64)
}

Discovery 服务发现

type RedisDiscovery

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

func NewRedisDiscovery

func NewRedisDiscovery(addr string, hearBeat uint, auth *string) (*RedisDiscovery, error)

func (*RedisDiscovery) Add

func (r *RedisDiscovery) Add(load int64)

func (*RedisDiscovery) Discovery

func (r *RedisDiscovery) Discovery(serName string) ([]*Server, error)

func (*RedisDiscovery) Less

func (r *RedisDiscovery) Less(load int64)

func (*RedisDiscovery) Limit

func (r *RedisDiscovery) Limit() bool

func (*RedisDiscovery) Registry

func (r *RedisDiscovery) Registry(serName, addr string, weights float64, protocol transport.Protocol, maximumLoad int64, serID *string) error

func (*RedisDiscovery) UnRegistry

func (r *RedisDiscovery) UnRegistry(serName string, serID string) error

type Server

type Server struct {
	ID          string             `json:"id"`           // ID
	ServerName  string             `json:"server_name"`  // 服务名称
	Addr        string             `json:"addr"`         // 地址
	Protocol    transport.Protocol `json:"protocol"`     // 协议
	Weights     float64            `json:"weights"`      // 权重
	MaximumLoad int64              `json:"maximum_load"` // 最大负载
	CurrentLoad int64              `json:"current_load"` // 当前负载
}

type SimplePeerToPeer

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

func NewSimplePeerToPeer

func NewSimplePeerToPeer(addr string, protocol transport.Protocol) *SimplePeerToPeer

func (*SimplePeerToPeer) Add

func (s *SimplePeerToPeer) Add(load int64)

func (*SimplePeerToPeer) Discovery

func (s *SimplePeerToPeer) Discovery(serName string) ([]*Server, error)

func (*SimplePeerToPeer) Less

func (s *SimplePeerToPeer) Less(load int64)

func (*SimplePeerToPeer) Limit

func (s *SimplePeerToPeer) Limit() bool

func (*SimplePeerToPeer) Registry

func (s *SimplePeerToPeer) Registry(serName, addr string, weights float64, protocol transport.Protocol, maximumLoad int64, serID *string) error

func (*SimplePeerToPeer) UnRegistry

func (s *SimplePeerToPeer) UnRegistry(serName string, serID string) error

Jump to

Keyboard shortcuts

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