config

package
v0.0.0-...-a8497ec Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SERVERNAME string //= "binlogbroker"

Functions

func GetConfig

func GetConfig(config_file string, config *ServerConfig) error

func GetConfigFromEtcd

func GetConfigFromEtcd(keyName string, cfg interface{}) error

func Init

func Init()

Types

type AlertConfig

type AlertConfig struct {
	Host         string
	Token        string
	DepartmentId []string
}

type BrokerConfig

type BrokerConfig struct {
	//group name from cmd line
	Group   string `json:"-"`
	LogDir  string
	LogFile string
	//etcd url, from cmd line
	EtcdAddr []string
	//binlog push to kafka
	KafkaAddr []string
	//admin port
	RPCListen string
	// on master/slave switched, sending message enterprise WeChat
	//Alert AlertConfig
	Alert struct {
		Host         string
		Token        string
		DepartmentId []string
	}
}

type DBConfig

type DBConfig struct {
	User   string
	Passwd string
	Net    string
	Addr   string
	DSN    string
}

type ServerConfig

type ServerConfig struct {
	//etcd: /v2/keys/config/binlogbroker
	BrokerConfig BrokerConfig
	//etcd: /v2/keys/config/binlogbroker:${group}, group name from the cmd line
	SourceConfig SourceConfig
}
var G_Config ServerConfig = ServerConfig{}

type Source

type Source struct {
	Schema string
	Tables []TopicInfo
}

type SourceConfig

type SourceConfig struct {
	//db conn: root:password@tcp(localhost:3306)
	MysqlConn string
	//parse from MysqlConn
	DBConfig struct {
		User   string
		Passwd string
		Net    string
		Addr   string
		DSN    string
	} `json:"-"`
	//db and table list
	Sources []Source
	//if sources config is empty and SyncAll is true,broker sync all, else do nothing
	SyncAll   bool
	BlackList []string //eg:schema.table
}

type TopicInfo

type TopicInfo struct {
	//table name
	Table string
	//to kafka topic name, default name is Schema name
	Topic string
	//kafka partion key name, default table name
	Key string
}

Jump to

Keyboard shortcuts

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