Documentation ¶
Index ¶
- func CloseProviders()
- func NewGrpc(data ...map[string]interface{})
- func NewGrpcClientConn(conf ServiceConfig, lb string, dialOptions ...grpc.DialOption) *grpc.ClientConn
- func NewRRGrpcClientConn(conf ServiceConfig, dialOptions ...grpc.DialOption) *grpc.ClientConn
- func NewRest(data ...map[string]interface{})
- func NewSWRRGrpcClientConn(conf ServiceConfig, dialOptions ...grpc.DialOption) *grpc.ClientConn
- func ShutdownGrpc()
- func ShutdownRest()
- type RRServiceProvider
- type SWRRServiceProvider
- type ServiceConfig
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseProviders ¶
func CloseProviders()
CloseProviders you must call CloseProviders when program is shutting down, otherwise goroutine will leak
func NewGrpcClientConn ¶
func NewGrpcClientConn(conf ServiceConfig, lb string, dialOptions ...grpc.DialOption) *grpc.ClientConn
func NewRRGrpcClientConn ¶
func NewRRGrpcClientConn(conf ServiceConfig, dialOptions ...grpc.DialOption) *grpc.ClientConn
NewRRGrpcClientConn is not thread-safe
func NewSWRRGrpcClientConn ¶
func NewSWRRGrpcClientConn(conf ServiceConfig, dialOptions ...grpc.DialOption) *grpc.ClientConn
NewSWRRGrpcClientConn is not thread-safe
func ShutdownGrpc ¶
func ShutdownGrpc()
func ShutdownRest ¶
func ShutdownRest()
Types ¶
type RRServiceProvider ¶
type RRServiceProvider struct {
// contains filtered or unexported fields
}
RRServiceProvider is a simple round-robin load balance implementation for IServiceProvider
func NewRRServiceProvider ¶
func NewRRServiceProvider(conf ServiceConfig) *RRServiceProvider
NewRRServiceProvider creates new RRServiceProvider instance. If you don't need it, You should call Close to release resource. You can also call CloseProviders to close all at one shot NewRRServiceProvider is not thread-safe
func (*RRServiceProvider) Close ¶
func (r *RRServiceProvider) Close()
func (*RRServiceProvider) SelectServer ¶
func (n *RRServiceProvider) SelectServer() string
SelectServer return service address from environment variable
type SWRRServiceProvider ¶
type SWRRServiceProvider struct {
*RRServiceProvider
}
SWRRServiceProvider is a smooth weighted round-robin service provider
func NewSWRRServiceProvider ¶
func NewSWRRServiceProvider(conf ServiceConfig) *SWRRServiceProvider
NewSWRRServiceProvider creates new SWRRServiceProvider instance
func (*SWRRServiceProvider) SelectServer ¶
func (n *SWRRServiceProvider) SelectServer() string
SelectServer selects a node which is supplying service specified by name property from cluster