config

package
v0.0.0-...-8010d25 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitManager

func InitManager(serverType consts.ServerType, serverMode consts.ServerMode, configType consts.ConfigType, metadata ...interface{}) error

Types

type AgentConfig

type AgentConfig struct {
	Addr           string `mapstructure:"addr"`
	MaxConnections int64  `mapstructure:"maxConnections"`
	MaxQPS         int64  `mapstructure:"maxQPS"`
	WorkerNum      int    `mapstructure:"workerNum"`
}

func (*AgentConfig) Init

func (conf *AgentConfig) Init()

type AgentManager

type AgentManager struct {
	RegistryConfigManager IRegistryConfigManager
	ServiceId             string
	ServiceName           string
	// contains filtered or unexported fields
}

func NewAgentManager

func NewAgentManager(config AgentConfig, registryConfig RegistryConfig, storeConfig StoreConfig, serviceId string) *AgentManager

func (*AgentManager) GetKitexServerOptions

func (cm *AgentManager) GetKitexServerOptions() []server.Option

type ApiConfig

type ApiConfig struct {
	Host       string           `mapstructure:"host"`
	Port       int              `mapstructure:"port"`
	Tracing    TracerConf       `mapstructure:"tracing"`
	MetricsUrl string           `mapstructure:"metricsUrl"`
	Dispatcher DispatcherConfig `mapstructure:"dispatcher"`
}

func (*ApiConfig) Init

func (conf *ApiConfig) Init()

type ApiManager

type ApiManager struct {
	RegistryConfigManager IRegistryConfigManager
	Server                *server.Hertz
	ServiceId             string
	ServiceName           string
	// contains filtered or unexported fields
}

func NewApiManager

func NewApiManager(config ApiConfig, registryConfig RegistryConfig, storeConfig StoreConfig, serviceId string) *ApiManager

type AppConfig

type AppConfig struct {
	RunMode                  string `mapstructure:"runMode"`
	Timezone                 string `mapstructure:"timezone"`
	ProxyUrl                 string `mapstructure:"proxyUrl"`
	SyncAgentServiceInterval string `mapstructure:"syncAgentServiceInterval"`
	SyncIdlInterval          string `mapstructure:"syncIdlInterval"`
}

func (*AppConfig) GetSyncAgentServiceInterval

func (conf *AppConfig) GetSyncAgentServiceInterval() time.Duration

func (*AppConfig) GetSyncIdlInterval

func (conf *AppConfig) GetSyncIdlInterval() time.Duration

func (*AppConfig) Init

func (conf *AppConfig) Init()

type BuiltinRegistryConfig

type BuiltinRegistryConfig struct {
	Address string `mapstructure:"address"`
}

type BuiltinRegistryConfigManager

type BuiltinRegistryConfigManager struct {
	Config BuiltinRegistryConfig

	RegistryType consts.RegistryType
	Registry     *registry.BuiltinRegistry
	// contains filtered or unexported fields
}

func NewBuiltinRegistryConfigManager

func NewBuiltinRegistryConfigManager(config BuiltinRegistryConfig, storeConfig StoreConfig) (*BuiltinRegistryConfigManager, error)

func (*BuiltinRegistryConfigManager) GetDiscoveryResolver

func (cm *BuiltinRegistryConfigManager) GetDiscoveryResolver() discovery.Resolver

func (*BuiltinRegistryConfigManager) GetKitexRegistry

func (cm *BuiltinRegistryConfigManager) GetKitexRegistry(serviceName, serviceId, addr string) (kitexregistry.Registry, *kitexregistry.Info)

func (*BuiltinRegistryConfigManager) GetRegistry

func (*BuiltinRegistryConfigManager) GetRegistryType

func (cm *BuiltinRegistryConfigManager) GetRegistryType() consts.RegistryType

type Cfg

type Cfg interface {
	Init()
}

type Config

type Config struct {
	App      AppConfig      `mapstructure:"app"`
	Logger   LoggerConfig   `mapstructure:"logger"`
	Registry RegistryConfig `mapstructure:"registry"`
	Store    StoreConfig    `mapstructure:"store"`
	Api      ApiConfig      `mapstructure:"api"`
	Agent    AgentConfig    `mapstructure:"agent"`
}

func (*Config) Init

func (conf *Config) Init()

type DispatcherConfig

type DispatcherConfig struct {
	Type string `mapstructure:"type"`
}

func (*DispatcherConfig) Init

func (conf *DispatcherConfig) Init()

func (*DispatcherConfig) NewDispatcher

func (conf *DispatcherConfig) NewDispatcher() dispatcher.IDispatcher

type FileConfig

type FileConfig struct {
	Path string
}

type IRegistryConfigManager

type IRegistryConfigManager interface {
	GetRegistryType() consts.RegistryType
	GetRegistry() registry.IRegistry
	GetKitexRegistry(serviceName, serviceId, addr string) (kitexregistry.Registry, *kitexregistry.Info)
	GetDiscoveryResolver() discovery.Resolver
}

type LoggerConfig

type LoggerConfig struct {
	SavePath     string `mapstructure:"savePath"`
	EncoderType  string `mapstructure:"encoderType"`
	EncodeLevel  string `mapstructure:"encodeLevel"`
	EncodeCaller string `mapstructure:"encodeCaller"`
}

func (*LoggerConfig) Init

func (conf *LoggerConfig) Init()

type Manager

type Manager struct {
	ServerType         consts.ServerType
	ServerMode         consts.ServerMode
	ServiceId          string
	Config             Config
	ApiConfigManager   *ApiManager
	AgentConfigManager *AgentManager
}

func GetManager

func GetManager() *Manager

type Metadata

type Metadata struct {
	ServiceId string `yaml:"service_id"`
}

type Mysql

type Mysql struct {
	Addr     string `mapstructure:"addr"`
	Port     string `mapstructure:"port"`
	Db       string `mapstructure:"db"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Charset  string `mapstructure:"charset"`
}

func (Mysql) GetDsn

func (m Mysql) GetDsn() string

type Redis

type Redis struct {
	Type       string          `mapstructure:"type"`
	StandAlone RedisStandAlone `mapstructure:"standalone"`
	Cluster    RedisCluster    `mapstructure:"cluster"`
}

type RedisCluster

type RedisCluster struct {
	MasterNum int `mapstructure:"masterNum"`
	Addrs     []*struct {
		Ip   string `mapstructure:"ip"`
		Port string `mapstructure:"port"`
	} `mapstructure:"addrs"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

type RedisStandAlone

type RedisStandAlone struct {
	Addr     string `mapstructure:"addr"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Db       int    `mapstructure:"db"`
}

type RegistryConfig

type RegistryConfig struct {
	Type    string                `mapstructure:"type"`
	Builtin BuiltinRegistryConfig `mapstructure:"builtin"`
}

func (*RegistryConfig) Init

func (conf *RegistryConfig) Init()

type RpcClientConf

type RpcClientConf struct {
	Name          string `mapstructure:"name" json:"name"`
	MuxConnection int    `mapstructure:"muxConnection" json:"mux_connection,default=1"`
}

type StoreConfig

type StoreConfig struct {
	Type  string `mapstructure:"type"`
	Mysql Mysql  `mapstructure:"mysql"`
	Redis Redis  `mapstructure:"redis"`
}

func (*StoreConfig) GetStoreType

func (conf *StoreConfig) GetStoreType() consts.StoreType

func (*StoreConfig) Init

func (conf *StoreConfig) Init()

func (*StoreConfig) NewMysqlDB

func (conf *StoreConfig) NewMysqlDB() (*gorm.DB, error)

func (*StoreConfig) NewRedisClient

func (conf *StoreConfig) NewRedisClient() (redis.UniversalClient, error)

type TracerConf

type TracerConf struct {
	Endpoint string  `mapstructure:"endpoint"`
	Sampler  float64 `mapstructure:"sampler"`
}

Jump to

Keyboard shortcuts

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