Documentation ¶
Index ¶
- func Check(ctx context.Context, etcdServers []string, etcdRoot string, ...) error
- type SvcDiscoveryRegistryImpl
- func (r *SvcDiscoveryRegistryImpl) AddOption(opts ...grpc.DialOption)
- func (r *SvcDiscoveryRegistryImpl) Close()
- func (r *SvcDiscoveryRegistryImpl) CloseConn(conn *grpc.ClientConn)
- func (r *SvcDiscoveryRegistryImpl) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func (r *SvcDiscoveryRegistryImpl) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error)
- func (r *SvcDiscoveryRegistryImpl) GetSelfConnTarget() string
- func (r *SvcDiscoveryRegistryImpl) GetUserIdHashGatewayHost(ctx context.Context, userId string) (string, error)
- func (r *SvcDiscoveryRegistryImpl) Register(serviceName, host string, port int, opts ...grpc.DialOption) error
- func (r *SvcDiscoveryRegistryImpl) UnRegister() error
- type ZkOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SvcDiscoveryRegistryImpl ¶
type SvcDiscoveryRegistryImpl struct {
// contains filtered or unexported fields
}
SvcDiscoveryRegistryImpl implementation
func NewSvcDiscoveryRegistry ¶
func NewSvcDiscoveryRegistry(rootDirectory string, endpoints []string, options ...ZkOption) (*SvcDiscoveryRegistryImpl, error)
NewSvcDiscoveryRegistry creates a new service discovery registry implementation
func (*SvcDiscoveryRegistryImpl) AddOption ¶
func (r *SvcDiscoveryRegistryImpl) AddOption(opts ...grpc.DialOption)
AddOption appends gRPC dial options to the existing options
func (*SvcDiscoveryRegistryImpl) Close ¶
func (r *SvcDiscoveryRegistryImpl) Close()
Close closes the etcd client connection
func (*SvcDiscoveryRegistryImpl) CloseConn ¶
func (r *SvcDiscoveryRegistryImpl) CloseConn(conn *grpc.ClientConn)
CloseConn closes a given gRPC client connection
func (*SvcDiscoveryRegistryImpl) GetConn ¶
func (r *SvcDiscoveryRegistryImpl) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
GetConn returns a single gRPC client connection for a given service name
func (*SvcDiscoveryRegistryImpl) GetConns ¶
func (r *SvcDiscoveryRegistryImpl) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error)
GetConns returns gRPC client connections for a given service name
func (*SvcDiscoveryRegistryImpl) GetSelfConnTarget ¶
func (r *SvcDiscoveryRegistryImpl) GetSelfConnTarget() string
GetSelfConnTarget returns the connection target for the current service
func (*SvcDiscoveryRegistryImpl) GetUserIdHashGatewayHost ¶
func (r *SvcDiscoveryRegistryImpl) GetUserIdHashGatewayHost(ctx context.Context, userId string) (string, error)
GetUserIdHashGatewayHost returns the gateway host for a given user ID hash
func (*SvcDiscoveryRegistryImpl) Register ¶
func (r *SvcDiscoveryRegistryImpl) Register(serviceName, host string, port int, opts ...grpc.DialOption) error
Register registers a new service endpoint with etcd
func (*SvcDiscoveryRegistryImpl) UnRegister ¶
func (r *SvcDiscoveryRegistryImpl) UnRegister() error
UnRegister removes the service endpoint from etcd
type ZkOption ¶
ZkOption defines a function type for modifying clientv3.Config
func WithDialTimeout ¶
WithDialTimeout sets a custom dial timeout for the etcd client
func WithMaxCallSendMsgSize ¶
WithMaxCallSendMsgSize sets a custom max call send message size for the etcd client
func WithUsernameAndPassword ¶
WithUsernameAndPassword sets a username and password for the etcd client