zookeeper

package
v0.0.50-alpha.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnIsNil               = errs.New("conn is nil")
	ErrConnIsNilButLocalNotNil = errs.New("conn is nil, but local is not nil")
)

Functions

func Check added in v0.0.48

func Check(ctx context.Context, ZkServers []string, scheme string, options ...ZkOption) error

Types

type Config added in v0.0.48

type Config struct {
	ZkServers []string
	Scheme    string
	Username  string
	Password  string
	Timeout   time.Duration
}

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func (*Resolver) Close

func (r *Resolver) Close()

func (*Resolver) ResolveNow

func (r *Resolver) ResolveNow(o resolver.ResolveNowOptions)

func (*Resolver) ResolveNowZK

func (r *Resolver) ResolveNowZK(o resolver.ResolveNowOptions)

type ZkClient

type ZkClient struct {
	ZkServers []string
	// contains filtered or unexported fields
}

func NewZkClient added in v0.0.47

func NewZkClient(ZkServers []string, scheme string, options ...ZkOption) (*ZkClient, error)

NewZkClient initializes a new ZkClient with provided options and establishes a Zookeeper connection.

func (*ZkClient) AddOption

func (s *ZkClient) AddOption(opts ...grpc.DialOption)

func (*ZkClient) Build

func (*ZkClient) Close

func (s *ZkClient) Close()

func (*ZkClient) CloseConn

func (s *ZkClient) CloseConn(conn *grpc.ClientConn)

func (*ZkClient) CreateRpcRootNodes

func (s *ZkClient) CreateRpcRootNodes(serviceNames []string) error

func (*ZkClient) CreateTempNode

func (s *ZkClient) CreateTempNode(rpcRegisterName, addr string) (node string, err error)

func (*ZkClient) GetClientLocalConns

func (s *ZkClient) GetClientLocalConns() map[string][]*grpc.ClientConn

func (*ZkClient) GetConfFromRegistry

func (s *ZkClient) GetConfFromRegistry(key string) ([]byte, error)

func (*ZkClient) GetConn

func (s *ZkClient) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

func (*ZkClient) GetConns

func (s *ZkClient) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]*grpc.ClientConn, error)

func (*ZkClient) GetConnsRemote

func (s *ZkClient) GetConnsRemote(ctx context.Context, serviceName string) (conns []resolver.Address, err error)

func (*ZkClient) GetNode

func (s *ZkClient) GetNode() string

func (*ZkClient) GetRootPath

func (s *ZkClient) GetRootPath() string

func (*ZkClient) GetSelfConnTarget

func (s *ZkClient) GetSelfConnTarget() string

func (*ZkClient) GetUserIdHashGatewayHost

func (s *ZkClient) GetUserIdHashGatewayHost(ctx context.Context, userId string) (string, error)

func (*ZkClient) GetZkConn

func (s *ZkClient) GetZkConn() *zk.Conn

func (*ZkClient) Register

func (s *ZkClient) Register(rpcRegisterName, host string, port int, opts ...grpc.DialOption) error

func (*ZkClient) RegisterConf2Registry

func (s *ZkClient) RegisterConf2Registry(key string, conf []byte) error

func (*ZkClient) Scheme

func (s *ZkClient) Scheme() string

func (*ZkClient) UnRegister

func (s *ZkClient) UnRegister() error

type ZkOption

type ZkOption func(*ZkClient)

func WithFreq

func WithFreq(freq time.Duration) ZkOption

func WithLogger

func WithLogger(logger log.Logger) ZkOption

func WithOptions

func WithOptions(opts ...grpc.DialOption) ZkOption

func WithRoundRobin

func WithRoundRobin() ZkOption

func WithTimeout

func WithTimeout(timeout int) ZkOption

func WithUserNameAndPassword

func WithUserNameAndPassword(userName, password string) ZkOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL