apollo

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryConfigName          = "retry"
	RpcTimeoutConfigName     = "rpc_timeout"
	CircuitBreakerConfigName = "circuit_break"

	LimiterConfigName = "limit"
)
View Source
const (
	JSON                         ConfigType = "json"
	YAML                         ConfigType = "yaml"
	ApolloDefaultConfigServerURL            = "127.0.0.1:8080"
	ApolloDefaultAppId                      = "KitexApp"
	ApolloDefaultCluster                    = "default"
	ApolloNameSpace                         = "{{.Category}}"
	ApolloDefaultClientKey                  = "{{.ClientServiceName}}.{{.ServerServiceName}}"
	ApolloDefaultServerKey                  = "{{.ServerServiceName}}"
)

Variables

View Source
var Close sync.Once

Functions

func GetUniqueID

func GetUniqueID() int64

GetUniqueID get the unique id

func NewCustomApolloLogger

func NewCustomApolloLogger() log.LoggerInterface

Types

type Client

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

Client the wrapper of apollo client.

func NewClient

func NewClient(opts Options, optsfunc ...OptionFunc) (Client, error)

type ConfigContent

type ConfigContent string

CustomFunction use for customize the config parameters.

type ConfigParam

type ConfigParam struct {
	Key string

	Cluster string
	Type    ConfigType
	// contains filtered or unexported fields
}

type ConfigParamConfig

type ConfigParamConfig struct {
	Category          string
	ClientServiceName string
	ServerServiceName string
}

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

type ConfigParser

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

ConfigParser the parser for Apollo config.

type ConfigType

type ConfigType string

CustomFunction use for customize the config parameters.

type CustomFunction

type CustomFunction func(*ConfigParam)

CustomFunction use for customize the config parameters.

type OptionFunc

type OptionFunc func(option *Options)

func WithApolloOption

func WithApolloOption(apolloOption ...agollo.Option) OptionFunc

type Options

type Options struct {
	ConfigServerURL string
	AppID           string
	Cluster         string
	ServerKeyFormat string
	ClientKeyFormat string
	ApolloOptions   []agollo.Option
	ConfigParser    ConfigParser
}

Jump to

Keyboard shortcuts

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