worker

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: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkerEventRowInsert = iota
	WorkerEventRowUpdate
	WorkerEventRowDelete
	WorkerEventDDL
)

WorkerEvent type

View Source
const (
	DispatchPolicyTableName = iota
	DispatchPolicyPrimaryKey
)

Dispatch policy

View Source
const (
	WorkerStatusNone = iota
	WorkerStatusRunning
	WorkerStatusAbnormal
	WorkerStatusExit
)

Worker status

Variables

This section is empty.

Functions

This section is empty.

Types

type DestinationConfig

type DestinationConfig struct {
	Name string
	/*
		Database destination fields
		Current support database: mysql or other mysql protocol compatible database (tidb ...)
	*/
	// Backup database connection
	DBs  []*mconn.DBConfig `json:"dbs" toml:"dbs"`
	Text bool              `json:"text" toml:"text"`
}

DestinationConfig is the data final destination config

type IJobExecutor

type IJobExecutor interface {
	Attach(interface{}) error
	Begin() error
	Exec(*WorkerEvent) error
	Rollback() error
	Commit() error
}

IJobExecutor define the interface of output destination

type WorkerConfig

type WorkerConfig struct {
	WorkerCount int                 `json:"worker-count" toml:"worker-count"`
	Tos         []DestinationConfig `json:"tos" toml:"tos"` // Multi destination output
}

WorkerConfig is worker config

type WorkerEvent

type WorkerEvent struct {
	Etype      int // Insert/Update/Delete
	Timestamp  uint32
	Point      mconn.ReplicationPoint
	Ti         *tableinfo.TableInfo
	Columns    []*tableinfo.ColumnWithValue
	NewColumns []*tableinfo.ColumnWithValue
	SDesc      *rule.SyncDesc
}

WorkerEvent holds the job IOutDest need to output

type WorkerManager

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

WorkerManager manages all workers

func NewWorkerManager

func NewWorkerManager(cfg *WorkerConfig) (*WorkerManager, error)

NewWorkerManager creates a new WorkerManager

func (*WorkerManager) DispatchWorkerEvent

func (w *WorkerManager) DispatchWorkerEvent(job *WorkerEvent, dispPolicy int) (bool, error)

DispatchWorkerEvent dispatchs WorkerEvent to worker, return true if replication point is checked

func (*WorkerManager) Start

func (w *WorkerManager) Start() error

Start starts all workers

func (*WorkerManager) Stop

func (w *WorkerManager) Stop()

Stop stops all workers

Jump to

Keyboard shortcuts

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