zookeeper

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2023 CloudWeGo Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	ZookeeperDefaultServer     = "127.0.0.1:2181"
	ZookeeperDefaultClientPath = "{{.ClientServiceName}}/{{.ServerServiceName}}/{{.Category}}"
	ZookeeperDefaultServerPath = "{{.ServerServiceName}}/{{.Category}}"
	ZookeeperDefaultPrefix     = "/KitexConfig"
)

Variables

This section is empty.

Functions

func GetUniqueID

func GetUniqueID() int64

GetUniqueID get the unique id

func NewCustomZookeeperLogger

func NewCustomZookeeperLogger() zk.Logger

Types

type Client

type Client interface {
	SetParser(ConfigParser)
	ClientConfigParam(cpc *ConfigParamConfig) (ConfigParam, error)
	ServerConfigParam(cpc *ConfigParamConfig) (ConfigParam, error)
	RegisterConfigCallback(context.Context, string, int64, func(bool, string, ConfigParser))
	DeregisterConfig(string, int64)
}

Client the wrapper of zookeeper client.

func NewClient

func NewClient(opts Options) (Client, error)

NewClient Create a default Zookeeper client

type ConfigParam

type ConfigParam struct {
	Prefix string
	Path   string
}

type ConfigParamConfig

type ConfigParamConfig struct {
	Category          string
	ClientServiceName string
	ServerServiceName string
}

ConfigParamConfig use for render the path info by go template, ref: https://pkg.go.dev/text/template The fixed key shows as below.

type ConfigParser

type ConfigParser interface {
	Decode(data string, config interface{}) error
}

ConfigParser the parser for zookeeper config.

type CustomFunction

type CustomFunction func(*ConfigParam)

CustomFunction use for customize the config parameters.

type Options

type Options struct {
	Servers          []string
	Prefix           string
	ServerPathFormat string
	ClientPathFormat string
	CustomLogger     zk.Logger
	ConfigParser     ConfigParser
}

Options zookeeper config options. All the fields have default value.

Jump to

Keyboard shortcuts

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