Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGTIDExecuted ¶
GetGTIDExecuted gets executed GTID set from the dump directory.
func SortBinlogs ¶
func SortBinlogs(binlogs []string)
SortBinlogs sort binlog filenames according to its number. `binlogs` should contains filenames such as `binlog.000001`.
Types ¶
type Operator ¶
type Operator interface { // Ping checks the connectivity to the database server. Ping() error // Close ust be called when the operator is no longer in use. Close() // GetServerStatus fills ServerStatus struct. GetServerStatus(context.Context, *ServerStatus) error // DumpFull takes a full dump of the database instance. // `dir` should exist before calling this. DumpFull(ctx context.Context, dir string) error // GetBinlogs returns a list of binary log files on the mysql instance. GetBinlogs(context.Context) ([]string, error) // DumpBinLog dumps binary log files starting from `binlogName`. // Transactions in `filterGTID` will be excluded. // `dir` should exist before calling this. DumpBinlog(ctx context.Context, dir, binlogName, filterGTID string) error // PrepareRestore prepares the database instance for loading data. PrepareRestore(context.Context) error // LoadDump loads data dumped by `DumpFull`. LoadDump(ctx context.Context, dir string) error // LoadBinLog applies binary logs up to `restorePoint`. LoadBinlog(ctx context.Context, binlogDir, tmpDir string, restorePoint time.Time) error // FinishRestore sets global variables of the database instance after restoration. FinishRestore(context.Context) error }
Operator is the interface to define backup and restore operations.
type ServerStatus ¶
type ServerStatus struct { SuperReadOnly bool `db:"@@super_read_only"` UUID string `db:"@@server_uuid"` CurrentBinlog string }
ServerStatus defines a struct to retrieve the backup source server status. These information will be used in the next backup to retrieve binary logs since the last backup.