Documentation
¶
Index ¶
- type Server
- type ServerOption
- type ServiceDiscovery
- type ServiceDiscoveryLB
- type ServiceDiscoveryOption
- func WithServiceDiscoveryBreaker(cb breaker.CircuitBreaker) ServiceDiscoveryOption
- func WithServiceDiscoveryGrpcDialOption(opts ...grpc.DialOption) ServiceDiscoveryOption
- func WithServiceDiscoveryGrpcDialTransportCredentials(credentials *credentials.TransportCredentials) ServiceDiscoveryOption
- func WithServiceDiscoveryLB(lb ServiceDiscoveryLB) ServiceDiscoveryOption
- func WithServiceDiscoveryRetry(retryPolicy *retry.Policy) ServiceDiscoveryOption
- func WithServiceDiscoveryTimeout(timeout time.Duration) ServiceDiscoveryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server interface {
RegisterService(serviceMetadata metadata.ServiceRegister, grpcRegister interface{}) error
Serve() error
Stop() error
}
Server grpc服务
func NewServer ¶
func NewServer(conf *config.ServerConfig, registry naming.Registry, opts ...ServerOption) Server
type ServerOption ¶
type ServerOption func(s *serverOption)
func WithServerGrpcServerOption ¶
func WithServerGrpcServerOption(opts ...grpc.ServerOption) ServerOption
WithServerGrpcServerOption grpc服务配置
func WithServiceLimiter ¶
func WithServiceLimiter(rateLimiter limiter.RateLimiter) ServerOption
WithServiceLimiter 服务端限流
type ServiceDiscovery ¶
type ServiceDiscovery interface {
// ServiceConn 获取服务连接信息
ServiceConn(serviceName string, opts ...ServiceDiscoveryOption) (*grpc.ClientConn, error)
}
ServiceDiscovery 服务发现
func NewServiceDiscovery ¶
func NewServiceDiscovery(appName string, resolverBuilder resolver.Builder) ServiceDiscovery
type ServiceDiscoveryLB ¶
type ServiceDiscoveryLB string
ServiceDiscoveryLB 负载均衡
const ( PickFirst ServiceDiscoveryLB = "pick_first" // 选择第一个 RoundRobin ServiceDiscoveryLB = "round_robin" // 轮询 )
type ServiceDiscoveryOption ¶
type ServiceDiscoveryOption func(s *serviceDiscoveryOption)
func WithServiceDiscoveryBreaker ¶
func WithServiceDiscoveryBreaker(cb breaker.CircuitBreaker) ServiceDiscoveryOption
WithServiceDiscoveryBreaker 设置熔断器
func WithServiceDiscoveryGrpcDialOption ¶
func WithServiceDiscoveryGrpcDialOption(opts ...grpc.DialOption) ServiceDiscoveryOption
func WithServiceDiscoveryGrpcDialTransportCredentials ¶
func WithServiceDiscoveryGrpcDialTransportCredentials(credentials *credentials.TransportCredentials) ServiceDiscoveryOption
func WithServiceDiscoveryLB ¶
func WithServiceDiscoveryLB(lb ServiceDiscoveryLB) ServiceDiscoveryOption
WithServiceDiscoveryLB 添加负载均衡选项
func WithServiceDiscoveryRetry ¶
func WithServiceDiscoveryRetry(retryPolicy *retry.Policy) ServiceDiscoveryOption
WithServiceDiscoveryRetry 设置重试
func WithServiceDiscoveryTimeout ¶
func WithServiceDiscoveryTimeout(timeout time.Duration) ServiceDiscoveryOption
WithServiceDiscoveryTimeout 添加超时设置选项
Click to show internal directories.
Click to hide internal directories.