Documentation
¶
Index ¶
- type FileReader
- type FileReaderConfig
- type FileReaderStatus
- type MockReader
- func (r *MockReader) Close() error
- func (r *MockReader) GetEvent(ctx context.Context) (*replication.BinlogEvent, error)
- func (r *MockReader) PushError(ctx context.Context, err error) error
- func (r *MockReader) PushEvent(ctx context.Context, ev *replication.BinlogEvent) error
- func (r *MockReader) StartSyncByGTID(gSet gtid.Set) error
- func (r *MockReader) StartSyncByPos(pos gmysql.Position) error
- func (r *MockReader) Status() interface{}
- type Reader
- type TCPReader
- type TCPReaderStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
FileReader is a binlog event reader which reads binlog events from a file.
func (*FileReader) GetEvent ¶
func (r *FileReader) GetEvent(ctx context.Context) (*replication.BinlogEvent, error)
GetEvent implements Reader.GetEvent.
func (*FileReader) StartSyncByGTID ¶
func (r *FileReader) StartSyncByGTID(gSet gtid.Set) error
StartSyncByGTID implements Reader.StartSyncByGTID.
func (*FileReader) StartSyncByPos ¶
func (r *FileReader) StartSyncByPos(pos gmysql.Position) error
StartSyncByPos implements Reader.StartSyncByPos.
func (*FileReader) Status ¶
func (r *FileReader) Status() interface{}
Status implements Reader.Status.
type FileReaderConfig ¶
type FileReaderConfig struct {
EnableRawMode bool
Timezone *time.Location
ChBufferSize int // event channel's buffer size
EchBufferSize int // error channel's buffer size
}
FileReaderConfig is the configuration used by a FileReader.
type FileReaderStatus ¶
type FileReaderStatus struct {
Stage string `json:"stage"`
ReadOffset uint32 `json:"read-offset"` // read event's offset in the file
SendOffset uint32 `json:"send-offset"` // sent event's offset in the file
}
FileReaderStatus represents the status of a FileReader.
func (*FileReaderStatus) String ¶
func (s *FileReaderStatus) String() string
String implements Stringer.String.
type MockReader ¶
type MockReader struct {
// returned error for methods
ErrStartByPos error
ErrStartByGTID error
ErrClose error
// contains filtered or unexported fields
}
MockReader is a binlog event reader which read binlog events from an input channel.
func (*MockReader) GetEvent ¶
func (r *MockReader) GetEvent(ctx context.Context) (*replication.BinlogEvent, error)
GetEvent implements Reader.GetEvent.
func (*MockReader) PushError ¶
func (r *MockReader) PushError(ctx context.Context, err error) error
PushError pushes an error into the reader.
func (*MockReader) PushEvent ¶
func (r *MockReader) PushEvent(ctx context.Context, ev *replication.BinlogEvent) error
PushEvent pushes an event into the reader.
func (*MockReader) StartSyncByGTID ¶
func (r *MockReader) StartSyncByGTID(gSet gtid.Set) error
StartSyncByGTID implements Reader.StartSyncByGTID.
func (*MockReader) StartSyncByPos ¶
func (r *MockReader) StartSyncByPos(pos gmysql.Position) error
StartSyncByPos implements Reader.StartSyncByPos.
func (*MockReader) Status ¶
func (r *MockReader) Status() interface{}
Status implements Reader.Status.
type Reader ¶
type Reader interface {
// StartSyncByPos prepares the reader for reading binlog from the specified position.
StartSyncByPos(pos gmysql.Position) error
// StartSyncByGTID prepares the reader for reading binlog from the specified GTID set.
StartSyncByGTID(gSet gtid.Set) error
// Close closes the reader and release the resource.
// Close will be blocked if `GetEvent` has not returned.
Close() error
// GetEvent gets the binlog event one by one, it will block if no event can be read.
// You can pass a context (like Cancel or Timeout) to break the block.
GetEvent(ctx context.Context) (*replication.BinlogEvent, error)
// Status returns the status of the reader.
Status() interface{}
}
Reader is a binlog event reader, it may read binlog events from a TCP stream, binlog files or any other in-memory buffer. One reader should read binlog events either through position mode or GTID mode.
func NewFileReader ¶
func NewFileReader(cfg *FileReaderConfig) Reader
NewFileReader creates a FileReader instance.
func NewTCPReader ¶
func NewTCPReader(syncerCfg replication.BinlogSyncerConfig) Reader
NewTCPReader creates a TCPReader instance.
type TCPReader ¶
type TCPReader struct {
// contains filtered or unexported fields
}
TCPReader is a binlog event reader which read binlog events from a TCP stream.
func (*TCPReader) GetEvent ¶
func (r *TCPReader) GetEvent(ctx context.Context) (*replication.BinlogEvent, error)
GetEvent implements Reader.GetEvent.
func (*TCPReader) StartSyncByGTID ¶
StartSyncByGTID implements Reader.StartSyncByGTID.
func (*TCPReader) StartSyncByPos ¶
StartSyncByPos implements Reader.StartSyncByPos.
type TCPReaderStatus ¶
TCPReaderStatus represents the status of a TCPReader.
func (*TCPReaderStatus) String ¶
func (s *TCPReaderStatus) String() string
String implements Stringer.String.