conf

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ConfClient get config client
	ConfClient *conf.Client
	// Conf canal config variable
	Conf = &Config{}
)

Functions

func Event

func Event() chan *InsConf

Event returns config change event chan,

func HBaseEvent

func HBaseEvent() chan *HBaseInsConf

HBaseEvent returns config change event chan,

func Init

func Init() (err error)

Init int config

func LoadCanal

func LoadCanal() (err error)

LoadCanal canal config

func TiDBEvent

func TiDBEvent() chan *TiDBInsConf

TiDBEvent .

Types

type Addition

type Addition struct {
	PrimaryKey []string `toml:"primarykey"` // kafka msg key
	OmitField  []string `toml:"omitfield"`  // field will be ignored in table
}

Addition addition attrbute of canal.

type CTable

type CTable struct {
	PrimaryKey []string `toml:"primarykey"` // kafka msg key
	OmitField  []string `toml:"omitfield"`  // field will be ignored in table
	OmitAction []string `toml:"omitaction"` // action will be ignored in table
	Name       string   `toml:"name"`       // table name support regular expression
	Tables     []string
}

CTable canal table.

type CanalConfig

type CanalConfig struct {
	Instances      []*InsConf      `toml:"instance"`
	HBaseInstances []*HBaseInsConf `toml:"hbase_instance"`
	TiDBInstances  []*TiDBInsConf  `toml:"tidb_instance"`
}

CanalConfig config struct

func LoadCanalConf

func LoadCanalConf() (c *CanalConfig, err error)

LoadCanalConf load canal config.

type Config

type Config struct {
	Monitor *Monitor
	// xlog
	Log *log.Config
	// http client
	HTTPClient *bm.ClientConfig
	// http server
	BM *bm.ServerConfig
	// master info
	MasterInfo *MasterInfoConfig
	// discovery
	Discovery *discovery.Config
	// db
	DB *sql.Config
}

Config canal config struct

type Database

type Database struct {
	Schema   string          `toml:"schema"`
	Databus  *databus.Config `toml:"databus"`
	Infoc    *infoc.Config   `toml:"infoc"`
	CTables  []*CTable       `toml:"table"`
	TableMap map[string]*Addition
}

Database represent mysql db

func (*Database) CheckTable

func (db *Database) CheckTable(addr, user, passwd string) (err error)

CheckTable check database tables.

type HBaseDatabase

type HBaseDatabase struct {
	Tables  []*HBaseTable   `toml:"table"`
	Databus *databus.Config `toml:"databus"`
}

HBaseDatabase hbase database.

type HBaseInsConf

type HBaseInsConf struct {
	Cluster string
	Root    string
	Addrs   []string

	MonitorPeriod xtime.Duration    `toml:"monitor_period"`
	MonitorOff    bool              `toml:"monitor_off"`
	Databases     []*HBaseDatabase  `toml:"db"`
	MasterInfo    *MasterInfoConfig `toml:"masterinfo"`
}

HBaseInsConf hbase instance config.

type HBaseTable

type HBaseTable struct {
	Name      string   `toml:"name"`      // table name
	OmitField []string `toml:"omitfield"` // field will be ignored in table
}

HBaseTable hbase canal table.

type InsConf

type InsConf struct {
	*canal.Config

	MonitorPeriod xtime.Duration    `toml:"monitor_period"`
	MonitorOff    bool              `toml:"monitor_off"`
	Databases     []*Database       `toml:"db"`
	MasterInfo    *MasterInfoConfig `toml:"masterinfo"`
}

InsConf instance config

type MasterInfoConfig

type MasterInfoConfig struct {
	Addr     string        `toml:"addr"`
	DBName   string        `toml:"dbName"`
	User     string        `toml:"user"`
	Password string        `toml:"password"`
	Timeout  time.Duration `toml:"timeout"`
}

MasterInfoConfig save pos of binlog in file or db

type Monitor

type Monitor struct {
	User   string
	Token  string
	Secret string
}

Monitor wechat monitor

type TiDBInsConf

type TiDBInsConf struct {
	Name          string
	ClusterID     string
	Addrs         []string
	Offset        int64
	CommitTS      int64
	MonitorPeriod xtime.Duration `toml:"monitor_period"`
	Databases     []*Database    `toml:"db"`
}

TiDBInsConf tidb instance config

Jump to

Keyboard shortcuts

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