Documentation ¶
Index ¶
- type Discovery
- type RedisDiscovery
- func (r *RedisDiscovery) Add(load int64)
- func (r *RedisDiscovery) Discovery(serName string) ([]*Server, error)
- func (r *RedisDiscovery) Less(load int64)
- func (r *RedisDiscovery) Limit() bool
- func (r *RedisDiscovery) Registry(serName, addr string, weights float64, protocol transport.Protocol, ...) error
- func (r *RedisDiscovery) UnRegistry(serName string, serID string) error
- type Server
- type SimplePeerToPeer
- func (s *SimplePeerToPeer) Add(load int64)
- func (s *SimplePeerToPeer) Discovery(serName string) ([]*Server, error)
- func (s *SimplePeerToPeer) Less(load int64)
- func (s *SimplePeerToPeer) Limit() bool
- func (s *SimplePeerToPeer) Registry(serName, addr string, weights float64, protocol transport.Protocol, ...) error
- func (s *SimplePeerToPeer) UnRegistry(serName string, serID string) error
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 ¶ added in v0.0.3
func (r *RedisDiscovery) Add(load int64)
func (*RedisDiscovery) Discovery ¶
func (r *RedisDiscovery) Discovery(serName string) ([]*Server, error)
func (*RedisDiscovery) Less ¶ added in v0.0.3
func (r *RedisDiscovery) Less(load int64)
func (*RedisDiscovery) Limit ¶ added in v0.0.3
func (r *RedisDiscovery) Limit() bool
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 ¶ added in v0.0.3
func (s *SimplePeerToPeer) Add(load int64)
func (*SimplePeerToPeer) Discovery ¶
func (s *SimplePeerToPeer) Discovery(serName string) ([]*Server, error)
func (*SimplePeerToPeer) Less ¶ added in v0.0.3
func (s *SimplePeerToPeer) Less(load int64)
func (*SimplePeerToPeer) Limit ¶ added in v0.0.3
func (s *SimplePeerToPeer) Limit() bool
func (*SimplePeerToPeer) UnRegistry ¶
func (s *SimplePeerToPeer) UnRegistry(serName string, serID string) error
Click to show internal directories.
Click to hide internal directories.