g

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() (err error)

Types

type Conf

type Conf struct {
	Log   *LogConf   `yaml:"Log"`
	Httpd *HttpdConf `yaml:"Httpd"`
	Raft  *RaftConf  `yaml:"Raft"`
}

全局配置

var (
	// 配置路径
	ConfPath = "./conf/config.yaml"

	Config *Conf
)

func DefaultConf

func DefaultConf() *Conf

func LoadConfig

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

func (*Conf) Debug

func (c *Conf) Debug()

type HttpdConf

type HttpdConf struct {
	Listen string `yaml:"Listen"`
}

Httpd配置

type LogConf

type LogConf struct {
	Verbose int    `yaml:"Verbose"` // 日志冗余度
	Way     string `yaml:"Way"`     // 日志方式"console" | "file"
	Dir     string `yaml:"Dir"`     // 日志目录,仅当Way是"file"是需要
}

日志配置

type RaftConf

type RaftConf struct {
	Enable              bool   `yaml:"Enable"`
	LocalID             string `yaml:"ID"`
	Bind                string `yaml:"Bind"`
	ClusterConfJson     string `yaml:"ClusterConfJson"`
	Storage             string `yaml:"Storage"`
	RootDir             string `yaml:"RootDir"`
	TCPMaxPool          int    `yaml:"TCPMaxPool"`
	Timeout             int64  `yaml:"Timeout"`             // Raft算法commit超时时间,单位毫秒
	LeaderWatchInterval int64  `yaml:"LeaderWatchInterval"` // 定时报告谁是Leader, 单位秒
}

Raft算法配置

Jump to

Keyboard shortcuts

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