Documentation
¶
Index ¶
- Variables
- func NewMockShift(log *xlog.Log) shift.ShiftHandler
- type MockShift
- type ShiftInfo
- type ShiftManager
- func (shiftMgr *ShiftManager) Close() error
- func (shiftMgr *ShiftManager) GetProgress(key string) *sqltypes.Result
- func (shiftMgr *ShiftManager) GetShiftType(key string) ShiftType
- func (shiftMgr *ShiftManager) GetStatus(key string) ShiftStatus
- func (shiftMgr *ShiftManager) Init() error
- func (shiftMgr *ShiftManager) NewShiftInstance(shiftInfo *ShiftInfo, typ ShiftType) (shift.ShiftHandler, error)
- func (shiftMgr *ShiftManager) StartShiftInstance(key string, shift shift.ShiftHandler, typ ShiftType) error
- func (shiftMgr *ShiftManager) StopAllInstance() error
- func (shiftMgr *ShiftManager) StopOneInstance(key string) error
- func (shiftMgr *ShiftManager) WaitInstanceFinish(key string) error
- func (shiftMgr *ShiftManager) WaitInstanceFinishThread(key string) error
- type ShiftMgrHandler
- type ShiftStatus
- type ShiftType
Constants ¶
This section is empty.
Variables ¶
var MockShiftInfo = &ShiftInfo{ From: "src", FromUser: "test", FromPassword: "test", FromDatabase: "testdb", FromTable: "tbl", To: "dst", ToUser: "user", ToPassword: "user", ToDatabase: "todb", ToTable: "totbl", Cleanup: false, Checksum: true, MysqlDump: "mysqldump", Threads: 128, PosBehinds: 2048, WaitTimeBeforeChecksum: 10, RadonURL: "", }
MockShiftInfo used to mock a shift info
Functions ¶
func NewMockShift ¶
func NewMockShift(log *xlog.Log) shift.ShiftHandler
NewMockShift used to new a mockshift
Types ¶
type MockShift ¶
type MockShift struct {
// contains filtered or unexported fields
}
MockShift used to mock a shift for test
func (*MockShift) ChecksumTable ¶
ChecksumTable used to checksum data src tbl and dst tbl.
func (*MockShift) SetStopSignal ¶
func (mockShift *MockShift) SetStopSignal()
SetStopSignal used set a stop signal to stop a shift work.
func (*MockShift) WaitFinish ¶
WaitFinish used to wait success or fail signal to finish.
type ShiftInfo ¶
type ShiftInfo struct {
From string
FromUser string
FromPassword string
FromDatabase string
FromTable string
To string
ToUser string
ToPassword string
ToDatabase string
ToTable string
Rebalance bool
Cleanup bool
Checksum bool
MysqlDump string
Threads int
PosBehinds int
WaitTimeBeforeChecksum int
RadonURL string
}
ShiftInfo used to record basic infos used by shift
type ShiftManager ¶
type ShiftManager struct {
// contains filtered or unexported fields
}
ShiftManager used to manager the infos about the shift Called by reshard/rebalance
func (*ShiftManager) Close ¶
func (shiftMgr *ShiftManager) Close() error
Close -- used to close all the shift instances that are on working When call Close(), WaitInstanceFinishThread will get err and exit goroutine
func (*ShiftManager) GetProgress ¶
func (shiftMgr *ShiftManager) GetProgress(key string) *sqltypes.Result
GetProgress -- used to get shift progress specified by key key: for reshard, key is `db`.`table`, for rebalance, key is `db`.`table`_backend
func (*ShiftManager) GetShiftType ¶
func (shiftMgr *ShiftManager) GetShiftType(key string) ShiftType
GetShiftType -- used to get shift type specified by key
func (*ShiftManager) GetStatus ¶
func (shiftMgr *ShiftManager) GetStatus(key string) ShiftStatus
GetStatus -- used to get shift status specified by key key: for reshard, key is `db`.`table`, for rebalance, key is `db`.`table`_backend
func (*ShiftManager) Init ¶
func (shiftMgr *ShiftManager) Init() error
Init -- used to init the plug module.
func (*ShiftManager) NewShiftInstance ¶
func (shiftMgr *ShiftManager) NewShiftInstance(shiftInfo *ShiftInfo, typ ShiftType) (shift.ShiftHandler, error)
NewShiftInstance -- used to new a shift instance
func (*ShiftManager) StartShiftInstance ¶
func (shiftMgr *ShiftManager) StartShiftInstance(key string, shift shift.ShiftHandler, typ ShiftType) error
StartShiftInstance -- used to start a new shift instance
func (*ShiftManager) StopAllInstance ¶
func (shiftMgr *ShiftManager) StopAllInstance() error
StopAllInstance used to stop all shift instances When call Close(), WaitInstanceFinishThread will get err and exit goroutine
func (*ShiftManager) StopOneInstance ¶
func (shiftMgr *ShiftManager) StopOneInstance(key string) error
StopOneInstance used to stop one shift instance specified by key key: for reshard, key is `db`.`table`, for rebalance, key is `db`.`table`_backend
func (*ShiftManager) WaitInstanceFinish ¶
func (shiftMgr *ShiftManager) WaitInstanceFinish(key string) error
WaitInstanceFinish -- used to wait instance run until finished.
func (*ShiftManager) WaitInstanceFinishThread ¶
func (shiftMgr *ShiftManager) WaitInstanceFinishThread(key string) error
WaitInstanceFinishThread -- used to start a thread to excute wait finish in background.
type ShiftMgrHandler ¶
type ShiftMgrHandler interface {
Init() error
NewShiftInstance(shiftInfo *ShiftInfo, typ ShiftType) (shift.ShiftHandler, error)
StartShiftInstance(key string, shift shift.ShiftHandler, typ ShiftType) error
WaitInstanceFinishThread(key string) error
WaitInstanceFinish(key string) error
StopOneInstance(key string) error
StopAllInstance() error
GetStatus(key string) ShiftStatus
GetProgress(key string) *sqltypes.Result
GetShiftType(key string) ShiftType
Close() error
}
func NewShiftManager ¶
func NewShiftManager(log *xlog.Log) ShiftMgrHandler
NewShiftManager -- used to create a new shift manager.
type ShiftStatus ¶
type ShiftStatus int
ShiftStatus used to indicates shift instance's status.
const ( // ShiftStatusNone enum, if status is none, some errors happen ShiftStatusNone ShiftStatus = iota // ShiftStatusMigrating enum ShiftStatusMigrating // ShiftStatusSuccess enum ShiftStatusSuccess // ShiftStatusFail enum ShiftStatusFail )