config

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 12

Documentation

Index

Constants

View Source
const (
	DefaultConstConfigFile = "constcfg"
	ClusterVersionFile     = "CLUSTER-VERSION"
	ClusterUUID            = "ClusterUUID"
)

Variables

This section is empty.

Functions

func CheckOrStoreClusterUuid added in v1.34.0

func CheckOrStoreClusterUuid(dirPath, id string, force bool) (err error)

func CheckOrStoreConstCfg added in v1.34.0

func CheckOrStoreConstCfg(fileDir, fileName string, cfg *ConstConfig) (ok bool, err error)

check listen port, raft replica port and raft heartbeat port

func NewIllegalConfigError added in v1.34.0

func NewIllegalConfigError(configKey string) error

Types

type Config

type Config struct {
	Raw []byte
	// contains filtered or unexported fields
}

Config defines the struct of a configuration in general.

func LoadConfigFile

func LoadConfigFile(filename string) (*Config, error)

LoadConfigFile loads config information from a JSON file.

func LoadConfigString

func LoadConfigString(s string) *Config

LoadConfigString loads config information from a JSON string.

func (*Config) CheckAndGetBool added in v1.34.0

func (c *Config) CheckAndGetBool(key string) (bool, bool)

GetBool returns a bool value for the config key.

func (*Config) CheckAndGetString added in v1.34.0

func (c *Config) CheckAndGetString(key string) (string, bool)

Check and get a string for the config key.

func (*Config) GetBool

func (c *Config) GetBool(key string) bool

GetBool returns a bool value for the config key.

func (*Config) GetBoolWithDefault added in v1.34.0

func (c *Config) GetBoolWithDefault(key string, defval bool) bool

returns a bool value for the config key with default val when not present

func (*Config) GetFloat

func (c *Config) GetFloat(key string) float64

GetFloat returns a float value for the config key.

func (*Config) GetInt

func (c *Config) GetInt(key string) int

GetInt returns a int value for the config key.

func (*Config) GetInt64

func (c *Config) GetInt64(key string) int64

GetInt64 returns a int64 value for the config key.

func (*Config) GetInt64WithDefault added in v1.34.0

func (c *Config) GetInt64WithDefault(key string, defaultVal int64) int64

GetInt64WithDefault returns a int64 value for the config key.

func (*Config) GetIntWithDefault added in v1.34.0

func (c *Config) GetIntWithDefault(key string, defaultVal int) int

GetInt returns a int value for the config key with default value.

func (*Config) GetSlice added in v1.34.0

func (c *Config) GetSlice(key string) []interface{}

GetSlice returns an array for the config key.

func (*Config) GetString

func (c *Config) GetString(key string) string

GetString returns a string for the config key.

func (*Config) GetStringSlice added in v1.34.0

func (c *Config) GetStringSlice(key string) []string

func (*Config) GetValue added in v1.34.0

func (c *Config) GetValue(key string) interface{}

GetValue returns the raw data for the config key.

func (*Config) HasKey added in v1.34.0

func (c *Config) HasKey(key string) bool

func (*Config) SetString added in v1.34.0

func (c *Config) SetString(key, val string)

GetString returns a string for the config key.

type ConstConfig added in v1.34.0

type ConstConfig struct {
	Listen           string `json:"listen"`
	RaftReplicaPort  string `json:"raftReplicaPort"`
	RaftHeartbetPort string `json:"raftHeartbetPort"`
}

func (*ConstConfig) Equals added in v1.34.0

func (ccfg *ConstConfig) Equals(cfg *ConstConfig) bool

Jump to

Keyboard shortcuts

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