Documentation ¶
Index ¶
- func Close() error
- func Connect(cfg *config.AppConfig) bool
- func ConnectInfoGet(l *db.Loc, tp int) *db.Addr
- func ConnectLow(cfg *config.AppConfig, nodb bool) *sql.DB
- func DeleteClusterInfo(name string) error
- func DeleteSchema(name string, typ string) error
- func DeregisterTable(svc string, sdb string, table string, input string, output string, version int) bool
- func GetCount() (int, error)
- func GetCurrentGTID(a *db.Addr) (gtid string, err error)
- func GetCurrentGTIDForDB(l *db.Loc) (string, error)
- func GetDB() *sql.DB
- func GetDbAddr() *db.Addr
- func GetGTID(d *db.Loc) (gtid string, err error)
- func GetNoDB() *sql.DB
- func GetOutputSchema(name string, typ string) string
- func GetSchema(svc string, sdb string, table string) (*types.TableSchema, error)
- func GetTableNewFlag(service, cluster, db, table, input, output string, version int) (n bool, err error)
- func GetVersion() int64
- func Init(cfg *config.AppConfig) bool
- func InsertClusterInfo(name string, ci *db.Addr) error
- func InsertSchema(name string, typ string, schema string) error
- func RegisterTable(dbl *db.Loc, table string, input string, output string, version int, ...) bool
- func ReplaceSchema(svc string, cluster string, s *types.TableSchema, rawSchema string, ...) bool
- func SaveBinlogState(d *db.Loc, gtid string, seqNo uint64) error
- func SetGTID(d *db.Loc, gtid string) error
- func SetTableNewFlag(service, cluster, db, table, input, output string, version int, flag bool) error
- func TableRegistered(id int64) (bool, error)
- func UpdateSchema(name string, typ string, schema string) error
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Connect connects to state DB. Returns false if connection failed
Exported for lock test
func ConnectInfoGet ¶
ConnectInfoGet resolves database address using state clusters table
func ConnectLow ¶
ConnectLow resolve address and connects to the state DB It can use state_connect_url config option, or using db.GetInfo resolver as any other database in the system
func DeleteClusterInfo ¶
DeleteClusterInfo delete cluster connection onfo from state database
func DeleteSchema ¶
DeleteSchema deletes output schema from the state
func DeregisterTable ¶
func DeregisterTable(svc string, sdb string, table string, input string, output string, version int) bool
DeregisterTable removes given table from the state
func GetCurrentGTID ¶
GetCurrentGTID returns current gtid set for the specified db address (host,port,user,password) FIXME: move to db package
func GetCurrentGTIDForDB ¶
GetCurrentGTIDForDB return current gtid set for the db specified by db locator (cluster,service,db) FIXME: move to db package
func GetNoDB ¶
GetNoDB returns active connection to the state database server Without connecting to any specific db
func GetOutputSchema ¶
GetOutputSchema returns output schema from the state
func GetTableNewFlag ¶
func GetTableNewFlag(service, cluster, db, table, input, output string, version int) (n bool, err error)
GetTableNewFlag returns the flag indicating whether the table has a snapshot
func GetVersion ¶
func GetVersion() int64
GetVersion track the state changes Return value changes when something got changed in the state, new tables inserted or removed It doesn't guarantee that return value will increase monotonically
func InsertClusterInfo ¶
InsertClusterInfo adds connection information for the cluster "name" to state
func InsertSchema ¶
InsertSchema inserts output schema into state
func RegisterTable ¶
func RegisterTable(dbl *db.Loc, table string, input string, output string, version int, outputFormat string) bool
RegisterTable adds table to the state
func ReplaceSchema ¶
func ReplaceSchema(svc string, cluster string, s *types.TableSchema, rawSchema string, oldGTID string, gtid string, input string, output string, version int, outputFormat string) bool
ReplaceSchema replaces both dtructured and raw schema definitions saved in the state with new versions provided as parameters If oldGtid is empty adds it as new table to the state FIXME: To big function. Split it.
func SaveBinlogState ¶
SaveBinlogState saves current state of the binlog reader to the state DB binlog state is current GTID set and current seqNo
func SetTableNewFlag ¶
func SetTableNewFlag(service, cluster, db, table, input, output string, version int, flag bool) error
SetTableNewFlag sets flag indicating that streamer has taken a snapshot of table
func TableRegistered ¶
TableRegistered checks if table with given id is still registered in the state Table id is id field from row structure
Types ¶
type Type ¶
type Type []row
Type is in-memory representation of state
func GetForCluster ¶
GetForCluster returns state rows for given cluster name
func GetTableByID ¶
GetTableByID return state row for the given table id