Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileConfig ¶
type FileConfig struct { RelayDir string // directory to store relay log files. Filename string // the startup relay log filename, if not set then a fake RotateEvent must be the first event. }
FileConfig is the configuration used by the FileWriter.
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter implements Writer interface.
func (*FileWriter) Recover ¶
func (w *FileWriter) Recover() (RecoverResult, error)
Recover implements Writer.Recover.
func (*FileWriter) WriteEvent ¶
func (w *FileWriter) WriteEvent(ev *replication.BinlogEvent) (Result, error)
WriteEvent implements Writer.WriteEvent.
type RecoverResult ¶
type RecoverResult struct { // true if recover operation has done and successfully. // false if no recover operation has done or unsuccessfully. Recovered bool // the latest binlog position after recover operation has done. LatestPos gmysql.Position // the latest binlog GTID set after recover operation has done. LatestGTIDs gtid.Set }
RecoverResult represents a result for a binlog recover operation.
type Result ¶
type Result struct { Ignore bool // whether the event ignored by the writer IgnoreReason string // why the writer ignore the event }
Result represents a write result.
type Writer ¶
type Writer interface { // Start prepares the writer for writing binlog events. Start() error // Close closes the writer and release the resource. Close() error // Recover tries to recover the binlog file or any other memory structure associate with this writer. // It is often used to recover a binlog file with some corrupt/incomplete binlog events/transactions at the end of the file. // It is not safe for concurrent use by multiple goroutines. // It should be called before writing to the file. Recover() (RecoverResult, error) // WriteEvent writes an binlog event's data into disk or any other places. // It is not safe for concurrent use by multiple goroutines. WriteEvent(ev *replication.BinlogEvent) (Result, error) // Flush flushes the buffered data to a stable storage or sends through the network. // It is not safe for concurrent use by multiple goroutines. Flush() error }
Writer writes binlog events into disk or any other memory structure. The writer should support:
- write binlog events and report the operation result
- skip any obsolete binlog events
- generate dummy events to fill the gap if needed
- rotate binlog(relay) file if needed
- rollback/discard unfinished binlog entries(events or transactions)
func NewFileWriter ¶
NewFileWriter creates a FileWriter instances.
Click to show internal directories.
Click to hide internal directories.