Documentation
¶
Index ¶
- Constants
- func GetBuildTime() string
- func GetBuildVersion() string
- func GetCommitID() string
- func InitConfig(path string)
- func LoadConfig(conf *Config, path string)
- func SetConfigVersion(bv, bt, ci string)
- type Base
- type Config
- func (config *Config) CurrentByMasterNameDomainIp(masterName string) error
- func (c *Config) GetDataDir() string
- func (c *Config) GetDataDirBySlot(model Model, pid uint32) string
- func (c *Config) GetDatas() []string
- func (config *Config) GetEmbed() (*embed.Config, error)
- func (this *Config) GetEtcdAddress() []string
- func (c *Config) GetLevel() string
- func (c *Config) GetLogDir() string
- func (c *Config) GetLogFileNum() int
- func (c *Config) GetLogFileSize() int
- func (config *Config) Validate(model Model) error
- type EtcdCfg
- type GlobalCfg
- type MasterCfg
- type Masters
- type Model
- type PSCfg
- type RouterCfg
Constants ¶
View Source
const ( LocalSingleAddr = "127.0.0.1" LocalCastAddr = "0.0.0.0" )
Variables ¶
This section is empty.
Functions ¶
func GetBuildTime ¶
func GetBuildTime() string
func GetBuildVersion ¶
func GetBuildVersion() string
func GetCommitID ¶
func GetCommitID() string
func InitConfig ¶
func InitConfig(path string)
func LoadConfig ¶
func SetConfigVersion ¶
func SetConfigVersion(bv, bt, ci string)
SetConfigVersion set the version, time and commit id of build
Types ¶
type Base ¶
type Base struct {
Log string `toml:"log,omitempty" json:"log"`
Level string `toml:"level,omitempty" json:"level"`
LogFileNum int `toml:"log_file_num,omitempty" json:"log_file_num"`
LogFileSize int `toml:"log_file_size,omitempty" json:"log_file_size"`
Data []string `toml:"data,omitempty" json:"data"`
}
type Config ¶
type Config struct {
Global *GlobalCfg `toml:"global,omitempty" json:"global"`
EtcdConfig *EtcdCfg `toml:"etcd,omitempty" json:"etcd"`
Masters Masters `toml:"masters,omitempty" json:"masters"`
Router *RouterCfg `toml:"router,omitempty" json:"router"`
PS *PSCfg `toml:"ps,omitempty" json:"ps"`
}
func (*Config) CurrentByMasterNameDomainIp ¶
CurrentByMasterNameDomainIp find this machine domain.The main purpose of this function is to find the master from from multiple masters and set it‘s Field:self to true. The only criterion for judging is: Is the IP address the same with one of the masters?
func (*Config) GetDataDir ¶
func (*Config) GetEtcdAddress ¶
get etcd address config
func (*Config) GetLogFileNum ¶
func (*Config) GetLogFileSize ¶
type GlobalCfg ¶
type GlobalCfg struct {
Base
Name string `toml:"name,omitempty" json:"name"`
Signkey string `toml:"signkey,omitempty" json:"signkey"`
SkipAuth bool `toml:"skip_auth,omitempty" json:"skip_auth"`
SelfManageEtcd bool `toml:"self_manage_etcd,omitempty" json:"self_manage_etcd"`
AutoRecoverPs bool `toml:"auto_recover_ps,omitempty" json:"auto_recover_ps"`
SupportEtcdAuth bool `toml:"support_etcd_auth,omitempty" json:"support_etcd_auth"`
RaftConsistent bool `toml:"raft_consistent,omitempty" json:"raft_consistent"`
MergeRouter bool `toml:"master_merge_into_router,omitempty" json:"master_merge_into_router"`
}
type MasterCfg ¶
type MasterCfg struct {
Name string `toml:"name,omitempty" json:"name"`
Address string `toml:"address,omitempty" json:"address"`
ApiPort uint16 `toml:"api_port,omitempty" json:"api_port"`
EtcdPort uint16 `toml:"etcd_port,omitempty" json:"etcd_port"`
EtcdPeerPort uint16 `toml:"etcd_peer_port,omitempty" json:"etcd_peer_port"`
EtcdClientPort uint16 `toml:"etcd_client_port,omitempty" json:"etcd_client_port"`
Self bool `json:"-"`
SkipAuth bool `toml:"skip_auth,omitempty" json:"skip_auth"`
PprofPort uint16 `toml:"pprof_port,omitempty" json:"pprof_port"`
MonitorPort uint16 `toml:"monitor_port" json:"monitor_port"`
}
type Masters ¶
type Masters []*MasterCfg
func (Masters) ClientAddress ¶
new client use this function to get client urls
type PSCfg ¶
type PSCfg struct {
RpcPort uint16 `toml:"rpc_port,omitempty" json:"rpc_port"`
PsHeartbeatTimeout int `toml:"ps_heartbeat_timeout" json:"ps_heartbeat_timeout"`
RaftHeartbeatPort uint16 `toml:"raft_heartbeat_port,omitempty" json:"raft_heartbeat_port"`
RaftReplicatePort uint16 `toml:"raft_replicate_port,omitempty" json:"raft_replicate_port"`
RaftHeartbeatInterval int `toml:"heartbeat_interval" json:"heartbeat-interval"`
RaftRetainLogs uint64 `toml:"raft_retain_logs" json:"raft-retain-logs"`
RaftReplicaConcurrency int `toml:"raft_replica_concurrency" json:"raft-replica-concurrency"`
RaftSnapConcurrency int `toml:"raft_snap_concurrency" json:"raft-snap-concurrency"`
RaftTruncateCount int64 `toml:"raft_truncate_count" json:"raft_truncate_count"`
RaftDiffCount uint64 `toml:"raft_diff_count" json:"raft_diff_count"`
EngineDWPTNum uint64 `toml:"engine_dwpt_num" json:"engine-dwpt-num"`
MaxSize int64 `toml:"max_size" json:"max_size"`
PprofPort uint16 `toml:"pprof_port" json:"pprof_port"`
Private bool `toml:"private" json:"private"` //this ps is private if true you must set machine by dbConfig
FlushTimeInterval uint32 `toml:"flush_time_interval" json:"flush_time_interval"` // seconds
FlushCountThreshold uint32 `toml:"flush_count_threshold" json:"flush_count_threshold"`
}
type RouterCfg ¶
type RouterCfg struct {
Port uint16 `toml:"port,omitempty" json:"port"`
PprofPort uint16 `toml:"pprof_port,omitempty" json:"pprof_port"`
RpcPort uint16 `toml:"rpc_port,omitempty" json:"rpc_port"`
MonitorPort uint16 `toml:"monitor_port" json:"monitor_port"`
ConnLimit int `toml:"conn_limit" json:"conn_limit"`
CloseTimeout int64 `toml:"close_timeout" json:"close_timeout"`
RouterIPS []string ``
}
Click to show internal directories.
Click to hide internal directories.