slave

package
v0.0.0-...-1609ee8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserClosed represents the slave is closed by user
	ErrUserClosed = errors.New("User closed")
)

Functions

This section is empty.

Types

type MasterStatus

type MasterStatus struct {
	Version string                 `json:"version"`
	Pos     mconn.ReplicationPoint `json:"position"`
}

MasterStatus is status of master

type Slave

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

Slave represents a slave node like a mysql slave to participate the mysql replication

func NewSlave

func NewSlave(dss []mconn.DataSource, rc *mconn.ReplicationConfig, srule rule.ISyncRule) *Slave

NewSlave creates a new slave

func (*Slave) GetDataSource

func (s *Slave) GetDataSource() *mconn.DataSource

GetDataSource get the current data source used by replication replication

func (*Slave) GetDataSourceIndex

func (s *Slave) GetDataSourceIndex() int

GetDataSourceIndex get the current data source index used by replication replication

func (*Slave) Next

func (s *Slave) Next(ctx context.Context) (*binlog.Event, error)

Next gets the binlog event until a binlog comes or context timeout

func (*Slave) Start

func (s *Slave) Start(pos mconn.ReplicationPoint) error

Start starts the slave at the position

func (*Slave) Stop

func (s *Slave) Stop()

Stop stops the slave

Jump to

Keyboard shortcuts

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