Documentation
¶
Index ¶
- type Server
- type ServerOption
- func WithServerGrpcServerOption(opts ...grpc.ServerOption) ServerOption
- func WithServerKeepalive(kep keepalive.EnforcementPolicy, kp keepalive.ServerParameters) ServerOption
- func WithServerLimiter(rateLimiter limiter.RateLimiter) ServerOption
- func WithServerOnStatusChange(callback naming.StatusChangeCallback) 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 WithServiceDiscoveryKeepalive(keepaliveTime, timeout time.Duration, backoffConf backoff.Config) ServiceDiscoveryOption
- func WithServiceDiscoveryLB(lb ServiceDiscoveryLB) ServiceDiscoveryOption
- func WithServiceDiscoveryRetry(retryPolicy *retry.Policy) 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 WithServerKeepalive ¶ added in v0.2.1
func WithServerKeepalive(kep keepalive.EnforcementPolicy, kp keepalive.ServerParameters) ServerOption
WithServerKeepalive grpc服务端心跳配置
func WithServerLimiter ¶ added in v0.2.1
func WithServerLimiter(rateLimiter limiter.RateLimiter) ServerOption
WithServerLimiter 服务端限流
func WithServerOnStatusChange ¶ added in v0.2.6
func WithServerOnStatusChange(callback naming.StatusChangeCallback) ServerOption
WithServerOnStatusChange 注册服务状态变更回调
type ServiceDiscovery ¶
type ServiceDiscovery interface {
// ServiceConn 获取服务连接信息
ServiceConn(serviceName string, opts ...ServiceDiscoveryOption) (*grpc.ClientConn, error)
}
ServiceDiscovery 服务发现
func NewServiceDiscovery ¶
func NewServiceDiscovery(resolverBuilder resolver.Builder) ServiceDiscovery
type ServiceDiscoveryLB ¶
type ServiceDiscoveryLB string
ServiceDiscoveryLB 负载均衡
const ( PickFirst ServiceDiscoveryLB = "pick_first" // 选择第一个 RoundRobin ServiceDiscoveryLB = "round_robin" // 轮询 WeightedRoundRobin ServiceDiscoveryLB = "weighted_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 WithServiceDiscoveryKeepalive ¶ added in v0.2.1
func WithServiceDiscoveryKeepalive(keepaliveTime, timeout time.Duration, backoffConf backoff.Config) ServiceDiscoveryOption
WithServiceDiscoveryKeepalive 添加保活与超时选项
func WithServiceDiscoveryLB ¶
func WithServiceDiscoveryLB(lb ServiceDiscoveryLB) ServiceDiscoveryOption
WithServiceDiscoveryLB 添加负载均衡选项
func WithServiceDiscoveryRetry ¶
func WithServiceDiscoveryRetry(retryPolicy *retry.Policy) ServiceDiscoveryOption
WithServiceDiscoveryRetry 设置重试
Click to show internal directories.
Click to hide internal directories.