nacos

package
v0.0.0-...-31da580 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOptions

func CreateOptions(cntCfg ClientConfig, cacheDir, logDir string) (options []constant.ClientOption)

func FetchConfig

func FetchConfig(conf *Config) (config.Config, error)

func NewNaCosClientParam

func NewNaCosClientParam(cfg *Config) vo.NacosClientParam

func NewNaCosConfigClient

func NewNaCosConfigClient(conf *Config) config_client.IConfigClient

func NewNaCosDiscovery

func NewNaCosDiscovery(conf *Config) registry.Discovery

func NewNaCosDiscoveryWiths

func NewNaCosDiscoveryWiths(opts ...Option) registry.Discovery

func NewNaCosNamingClient

func NewNaCosNamingClient(conf *Config) naming_client.INamingClient

func NewNaCosRegistrar

func NewNaCosRegistrar(conf *Config) registry.Registrar

func NewNaCosRegistrarWiths

func NewNaCosRegistrarWiths(opts ...Option) registry.Registrar

func NewSources

func NewSources[T any](sources ...T) []T

Types

type ClientConfig

type ClientConfig interface {
	RollingConfig

	GetNamespace() string
	GetTimeout() uint64
	GetUsername() string
	GetPassword() string
	GetCacheDir() string
	GetLogDir() string
	GetLogLevel() string
	GetUpdateThreadNum() int
	GetNotLoadCacheAtStart() bool
}

type ClientOption

type ClientOption struct {
	Username            string `json:"username" yaml:"username"`
	Password            string `json:"password" yaml:"password"`
	CacheDir            string `json:"cache_dir" yaml:"cache_dir"`
	LogDir              string `json:"log_dir" yaml:"log_dir"`
	LogLevel            string `json:"log_level" yaml:"log_level"`
	Timeout             uint64 `json:"timeout" yaml:"timeout"`
	Namespace           string `json:"namespace" yaml:"namespace"`
	MaxBackups          int64  `json:"max_backups" yaml:"max_backups"`
	MaxAge              int64  `json:"rolling_max_age" yaml:"rolling_max_age"`
	MaxSize             int64  `json:"rolling_max_size" yaml:"rolling_max_size"`
	UpdateThreadNum     int    `json:"update_thread_num" yaml:"update_thread_num"`
	NotLoadCacheAtStart bool   `json:"not_load_cache_at_start" yaml:"not_load_cache_at_start"`
}

func (*ClientOption) GetCacheDir

func (c *ClientOption) GetCacheDir() string

func (*ClientOption) GetLogDir

func (c *ClientOption) GetLogDir() string

func (*ClientOption) GetLogLevel

func (c *ClientOption) GetLogLevel() string

func (*ClientOption) GetMaxAge

func (c *ClientOption) GetMaxAge() int64

func (*ClientOption) GetMaxBackups

func (c *ClientOption) GetMaxBackups() int64

func (*ClientOption) GetMaxSize

func (c *ClientOption) GetMaxSize() int64

func (*ClientOption) GetNamespace

func (c *ClientOption) GetNamespace() string

func (*ClientOption) GetNotLoadCacheAtStart

func (c *ClientOption) GetNotLoadCacheAtStart() bool

func (*ClientOption) GetPassword

func (c *ClientOption) GetPassword() string

func (*ClientOption) GetTimeout

func (c *ClientOption) GetTimeout() uint64

func (*ClientOption) GetUpdateThreadNum

func (c *ClientOption) GetUpdateThreadNum() int

func (*ClientOption) GetUsername

func (c *ClientOption) GetUsername() string

type Config

type Config struct {
	GlbCfg    GlobalConfig   `json:"global" yaml:"global"`
	SerCfgArr []ServerConfig `json:"servers" yaml:"servers"`
	CntCfg    ClientConfig   `json:"client_config" yaml:"client_config"`
	SrcCfgArr []SourceConfig `json:"sources" yaml:"sources"`
}

func NewNaCosConfig

func NewNaCosConfig(opts ...Option) *Config

func (*Config) GetGlobalConfig

func (c *Config) GetGlobalConfig() GlobalConfig

type Global

type Global struct {
	AppName string `json:"app_name" yaml:"app_name"`
}

func NewGlobal

func NewGlobal(name string) *Global

func (*Global) GetAppName

func (g *Global) GetAppName() string

type GlobalConfig

type GlobalConfig interface {
	GetAppName() string
}

type Option

type Option func(*Config)

func WithClientOption

func WithClientOption(opt *ClientOption) Option

func WithGlobal

func WithGlobal(g *Global) Option

func WithServers

func WithServers(serv ...ServerConfig) Option

func WithSources

func WithSources(source ...SourceConfig) Option

type RollingConfig

type RollingConfig interface {
	GetMaxAge() int64
	GetMaxSize() int64
	GetMaxBackups() int64
}

type Server

type Server struct {
	Port    uint64 `json:"port" yaml:"port"`
	Address string `json:"address" yaml:"address"`
}

func (*Server) GetAddress

func (s *Server) GetAddress() string

func (*Server) GetPort

func (s *Server) GetPort() uint64

type ServerConfig

type ServerConfig interface {
	GetAddress() string
	GetPort() uint64
}

type Source

type Source struct {
	Group  string `yaml:"group" json:"group"`
	DataId string `yaml:"data_id" json:"data_id"`
}

func (*Source) GetDataId

func (s *Source) GetDataId() string

func (*Source) GetGroup

func (s *Source) GetGroup() string

type SourceConfig

type SourceConfig interface {
	GetDataId() string
	GetGroup() string
}

Jump to

Keyboard shortcuts

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