Versions in this module Expand all Collapse all v1 v1.0.2 Oct 19, 2024 Changes in this version + var ErrConnIsNil = errs.New("conn is nil") + var ErrConnIsNilButLocalNotNil = errs.New("conn is nil, but local is not nil") + func Check(ctx context.Context, ZkServers []string, scheme string, options ...ZkOption) error + type Config struct + Password string + Scheme string + Timeout time.Duration + Username string + ZkServers []string + type Resolver struct + func (r *Resolver) Close() + func (r *Resolver) ResolveNow(o resolver.ResolveNowOptions) + func (r *Resolver) ResolveNowZK(o resolver.ResolveNowOptions) + type ZkClient struct + ZkServers []string + func NewZkClient(ZkServers []string, scheme string, options ...ZkOption) (*ZkClient, error) + func (s *ZkClient) AddOption(opts ...grpc.DialOption) + func (s *ZkClient) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) + func (s *ZkClient) Close() + func (s *ZkClient) CloseConn(conn *grpc.ClientConn) + func (s *ZkClient) CreateRpcRootNodes(serviceNames []string) error + func (s *ZkClient) CreateTempNode(rpcRegisterName, addr string) (node string, err error) + func (s *ZkClient) GetClientLocalConns() map[string][]*grpc.ClientConn + func (s *ZkClient) GetConfFromRegistry(key string) ([]byte, error) + func (s *ZkClient) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error) + func (s *ZkClient) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error) + func (s *ZkClient) GetConnsRemote(ctx context.Context, serviceName string) (conns []resolver.Address, err error) + func (s *ZkClient) GetNode() string + func (s *ZkClient) GetRootPath() string + func (s *ZkClient) GetSelfConnTarget() string + func (s *ZkClient) GetUserIdHashGatewayHost(ctx context.Context, userId string) (string, error) + func (s *ZkClient) GetZkConn() *zk.Conn + func (s *ZkClient) Register(rpcRegisterName, host string, port int, opts ...grpc.DialOption) error + func (s *ZkClient) RegisterConf2Registry(key string, conf []byte) error + func (s *ZkClient) Scheme() string + func (s *ZkClient) UnRegister() error + type ZkOption func(*ZkClient) + func WithFreq(freq time.Duration) ZkOption + func WithLogger(logger log.Logger) ZkOption + func WithOptions(opts ...grpc.DialOption) ZkOption + func WithRoundRobin() ZkOption + func WithTimeout(timeout int) ZkOption + func WithUserNameAndPassword(userName, password string) ZkOption