binlog

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binlog

type Binlog struct {
	// contains filtered or unexported fields
}

Binlog tuple.

func NewBinlog

func NewBinlog(log *xlog.Log, conf *config.BinlogConfig) *Binlog

NewBinlog creates the new binlog tuple.

func (*Binlog) Close

func (bin *Binlog) Close()

Close used to close the bin.

func (*Binlog) CloseSQLWorker

func (bin *Binlog) CloseSQLWorker(sqlworker *SQLWorker)

CloseSQLWorker used to close the sqlworker.

func (*Binlog) Init

func (bin *Binlog) Init() error

Init used to init the ioworker.

func (*Binlog) LastGTID

func (bin *Binlog) LastGTID() int64

LastGTID returns the last event GTID.

func (*Binlog) LogEvent

func (bin *Binlog) LogEvent(typ string, schema string, sql string)

LogEvent used to write the event to the bin.

func (*Binlog) NewSQLWorker

func (bin *Binlog) NewSQLWorker(ts int64) (*SQLWorker, error)

NewSQLWorker creates the new sql worker.

func (*Binlog) RelayInfos

func (bin *Binlog) RelayInfos() []RelayInfo

RelayInfos returns all the sqlworker status.

type Event

type Event struct {
	// An identifier that describes the event type.
	Type    string
	Schema  string
	Query   string
	Version uint16
	// The GTID of this event.
	Timestamp uint64
	// The name of the file that is being listed.
	LogName string
	// The position at which the event occurs.
	Pos int64
	// The position at which the next event begins, which is equal to Pos plus the size of the event.
	EndLogPos int64
}

Event binlog event.

type IOWorker

type IOWorker struct {
	// contains filtered or unexported fields
}

IOWorker tuple.

func NewIOWorker

func NewIOWorker(log *xlog.Log, conf *config.BinlogConfig) *IOWorker

NewIOWorker creates the new IOWorker.

func (*IOWorker) Close

func (io *IOWorker) Close()

Close used to close the io worker.

func (*IOWorker) GTID

func (io *IOWorker) GTID() int64

GTID returns the last event Timestamp.

func (*IOWorker) Init

func (io *IOWorker) Init() error

Init used to create the log dir.

func (*IOWorker) LogEvent

func (io *IOWorker) LogEvent(typ string, schema string, query string)

LogEvent used to write the query to binary log.

type Info

type Info struct {
	// contains filtered or unexported fields
}

Info tuple.

func NewInfo

func NewInfo(log *xlog.Log, conf *config.BinlogConfig, fileName string) *Info

NewInfo returns info tuple.

func (*Info) Close

func (inf *Info) Close()

Close used to close the file of relay.

func (*Info) Init

func (inf *Info) Init() error

Init used to init the relay.

func (*Info) ReadTs

func (inf *Info) ReadTs() (int64, error)

ReadTs used to get the ts from the relay file.

func (*Info) Sync

func (inf *Info) Sync(binlog string, ts int64) error

Sync used to sync the ts to the relay file.

type RelayInfo

type RelayInfo struct {
	ID            int64
	StartGTID     int64
	RelayGTID     int64
	LastWriteGTID int64
	Relaybin      string
	RelayPosition int64
	SecondBehinds int64
}

RelayInfo represents the relay sqlworker status.

type SQLWorker

type SQLWorker struct {
	// contains filtered or unexported fields
}

SQLWorker tuple.

func NewSQLWorker

func NewSQLWorker(log *xlog.Log, conf *config.BinlogConfig, ts int64) *SQLWorker

NewSQLWorker creates the new SQLWorker.

func (*SQLWorker) Init

func (sql *SQLWorker) Init() error

Init used to init the sql current position and seek to the right event.

func (*SQLWorker) NextEvent

func (sql *SQLWorker) NextEvent() (*Event, error)

NextEvent used to read the next event. If we get the end of the current binlog file and don't have next binlog, just returns (nil,nil).

func (*SQLWorker) RelayGTID

func (sql *SQLWorker) RelayGTID() int64

RelayGTID returns the last event timestamp have read.

func (*SQLWorker) RelayName

func (sql *SQLWorker) RelayName() string

RelayName returns the current binlog which are read.

func (*SQLWorker) RelayPosition

func (sql *SQLWorker) RelayPosition() int64

RelayPosition returns the current binlog position which are read.

func (*SQLWorker) SeekGTID

func (sql *SQLWorker) SeekGTID() int64

SeekGTID returns the timestamp which we started.

Jump to

Keyboard shortcuts

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