config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: GPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteConfig

func WriteConfig(path string, conf *Config) error

Types

type BackupConfig

type BackupConfig struct {
	// MUST: set in init
	SSHHost               string `json:"ssh-host"`
	SSHUser               string `json:"ssh-user"`
	SSHPasswd             string `json:"ssh-passwd"`
	SSHPort               int    `json:"ssh-port"`
	BackupDir             string `json:"backupdir"`
	XtrabackupBinDir      string `json:"xtrabackup-bindir"`
	BackupIOPSLimits      int    `json:"backup-iops-limits"`
	UseMemory             string `json:"backup-use-memory"`
	Parallel              int    `json:"backup-parallel"`
	MysqldMonitorInterval int    `json:"mysqld-monitor-interval"`

	// mysql admin
	Admin string

	// mysql passed
	Passwd string

	// mysql host
	Host string

	// mysql prot
	Port int

	// mysql basedir
	Basedir string

	// mysql default file
	DefaultsFile string
}

func DefaultBackupConfig

func DefaultBackupConfig() *BackupConfig

func (*BackupConfig) UnmarshalJSON

func (c *BackupConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON interface on BackupConfig.

type Config

type Config struct {
	Server      *ServerConfig      `json:"server"`
	Raft        *RaftConfig        `json:"raft"`
	Mysql       *MysqlConfig       `json:"mysql"`
	Replication *ReplicationConfig `json:"replication"`
	Backup      *BackupConfig      `json:"backup"`
	RPC         *RPCConfig         `json:"rpc"`
	Log         *LogConfig         `json:"log"`
}

func DefaultConfig

func DefaultConfig() *Config

func LoadConfig

func LoadConfig(path string) (*Config, error)

type LogConfig

type LogConfig struct {
	Level string `json:"level"`
}

func DefaultLogConfig

func DefaultLogConfig() *LogConfig

func (*LogConfig) UnmarshalJSON

func (c *LogConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON interface on LogConfig.

type MysqlConfig

type MysqlConfig struct {
	// mysql admin user
	Admin string `json:"admin"`

	// mysql admin passwd
	Passwd string `json:"passwd"`

	// mysql localhost
	Host string `json:"host"`

	// mysql local port
	Port int `json:"port"`

	// mysql basedir
	Basedir string `json:"basedir"`

	// mysql default file path
	DefaultsFile string `json:"defaults-file"`

	// ping mysql interval(ms)
	PingTimeout int `json:"ping-timeout"`

	// admit defeat count for ping mysql
	AdmitDefeatPingCnt int `json:"admit-defeat-ping-count"`

	// master system variables configure(separated by ;)
	MasterSysVars string `json:"master-sysvars"`

	// slave system variables configure(separated by ;)
	SlaveSysVars string `json:"slave-sysvars"`

	// mysql intranet ip, other replicas Master_Host
	ReplHost string

	// mysql replication user
	ReplUser string

	// mysql replication user pwd
	ReplPasswd string
}

func DefaultMysqlConfig

func DefaultMysqlConfig() *MysqlConfig

func (*MysqlConfig) UnmarshalJSON

func (c *MysqlConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON interface on MysqlConfig.

type RPCConfig

type RPCConfig struct {
	RequestTimeout int `json:"request-timeout"`
}

func DefaultRPCConfig

func DefaultRPCConfig() *RPCConfig

func (*RPCConfig) UnmarshalJSON

func (c *RPCConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON interface on RPCConfig.

type RaftConfig

type RaftConfig struct {
	// raft meta datadir
	MetaDatadir string `json:"meta-datadir"`

	// leader heartbeat interval(ms)
	HeartbeatTimeout int `json:"heartbeat-timeout"`

	// admit defeat count for hearbeat
	AdmitDefeatHtCnt int `json:"admit-defeat-hearbeat-count"`

	// election timeout(ms)
	ElectionTimeout int `json:"election-timeout"`

	// purge binlog interval (ms)
	PurgeBinlogInterval int `json:"purge-binlog-interval"`

	// start as idle
	StartAsIDLE bool `json:"start-as-idle"`

	// MUST: set in init
	// the shell command when leader start
	LeaderStartCommand string `json:"leader-start-command"`

	// MUST: set in init
	// the shell command when leader stop
	LeaderStopCommand string `json:"leader-stop-command"`

	// if true, xenon binlog-purge will be skipped, default is false.
	PurgeBinlogDisabled bool `json:"purge-binlog-disabled"`

	// rpc client request tiemout(ms)
	RequestTimeout int
}

func DefaultRaftConfig

func DefaultRaftConfig() *RaftConfig

func (*RaftConfig) UnmarshalJSON

func (c *RaftConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON interface on RaftConfig.

type ReplicationConfig

type ReplicationConfig struct {
	User   string `json:"user"`
	Passwd string `json:"passwd"`
}

func DefaultReplicationConfig

func DefaultReplicationConfig() *ReplicationConfig

func (*ReplicationConfig) UnmarshalJSON

func (c *ReplicationConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON interface on ReplicationConfig.

type ServerConfig

type ServerConfig struct {
	// MUST: set in init
	// connection string(format ip:port)
	Endpoint string `json:"endpoint"`
}

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

func (*ServerConfig) UnmarshalJSON

func (c *ServerConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON interface on ServerConfig.

Jump to

Keyboard shortcuts

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