config

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

View Source
const (
	DEFAULT_DB_MAX_IDLE_CONNS = 1024
	DEFAULT_DB_MAX_OPEN_CONNS = 1024
	DEFAULT_GC_CHECK_TIME     = 5
)
View Source
const (
	CFG_SUFFIX = "toml"
)

Variables

This section is empty.

Functions

func ReadConfigs

func ReadConfigs(dir string, funcConfigParse FuncConfigParse) error

Types

type CacheConfig

type CacheConfig struct {
	Mode              int
	Nodes             []string
	Master            string
	Address           string
	Password          string
	ConnectionTimeout int
	ReadTimeout       int
	WriteTimeout      int
	KeepAlive         int
	PoolMaxIdle       int
	PoolIdleTimeout   int
}

func (*CacheConfig) Parse

func (cc *CacheConfig) Parse(vals map[string]interface{}) error

type CommonConfig

type CommonConfig struct {
	Log   LogConfig
	Cache CacheConfig
}

func ReadCommonConfig

func ReadCommonConfig(dir string) (*CommonConfig, error)

func (*CommonConfig) Parse

func (cc *CommonConfig) Parse() error

type Config

type Config struct {
	Endpoint   EndpointConfig
	Log        LogConfig
	StorageCfg StorageConfig
	Database   DatabaseConfig
}

func (*Config) Parse

func (config *Config) Parse() error

type ConfigWatcher

type ConfigWatcher struct {
	FuncConfigParse FuncConfigParse
	// contains filtered or unexported fields
}

func NewConfigWatcher

func NewConfigWatcher(funcConfigParse FuncConfigParse) (*ConfigWatcher, error)

func (*ConfigWatcher) Error

func (cw *ConfigWatcher) Error() error

func (*ConfigWatcher) Stop

func (cw *ConfigWatcher) Stop()

func (*ConfigWatcher) Watch

func (cw *ConfigWatcher) Watch(dir string)

type DatabaseConfig

type DatabaseConfig struct {
	DbType       string
	DbUrl        string
	DbPassword   string
	MaxIdleConns int
	MaxOpenConns int
}

func (*DatabaseConfig) Parse

func (dc *DatabaseConfig) Parse(vals map[string]interface{}) error

type EndpointConfig

type EndpointConfig struct {
	Url       string
	MachineId int
	// how frequency to perform a gc in seconds.
	GcCheckTime int64
}

func (*EndpointConfig) Parse

func (ec *EndpointConfig) Parse(vals map[string]interface{}) error

type FuncConfigParse

type FuncConfigParse func(config *Config) error

type LogConfig

type LogConfig struct {
	Path  string
	Level int
}

func (*LogConfig) Parse

func (lc *LogConfig) Parse(vals map[string]interface{}) error

type StorageConfig

type StorageConfig struct {
	CephPath string
}

func (*StorageConfig) Parse

func (sc *StorageConfig) Parse(vals map[string]interface{}) error

Jump to

Keyboard shortcuts

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