grpcx

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*grpc.Server
	Port int
	// 向前兼容,默认依旧使用etcd,要用consul时才把这个字段设置成true,并传递consul地址
	UseConsulClient bool
	EtcdAddrs       []string
	ConsulAddrs     string
	Name            string
	L               logger.Logger
	// 微服务是否以host模式运行,是host则自动获取本地ip地址注册到注册中心
	// 不是host模式则以Name作为微服务访问地址(k8s中则为svc名称,docker中则为container名称)
	IsHost bool
	// 是否使用本仓库的权重负载均衡,使用则传递Weight为权重值
	UseWrr bool
	// 使用权重负载均衡,又没传weight则默认为10
	// weight建议为10的整数倍
	Weight int
	// contains filtered or unexported fields
}

func (*Server) Close added in v0.2.0

func (s *Server) Close() error

func (*Server) Serve

func (s *Server) Serve() error

Serve 启动服务器并且阻塞

Directories

Path Synopsis
balancer
wrr
log
resolver

Jump to

Keyboard shortcuts

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