Documentation ¶
Index ¶
- Constants
- type DDL
- type DDLLock
- type Lock
- type Manage
- func (d *Manage) BecomeMaster(key string)
- func (d *Manage) CallLock(l *DDLLock, result *Result)
- func (d *Manage) CallUnLock(l *DDLLock, result *Result)
- func (d *Manage) CreateDatabase(uname, database string, num int) (string, uint64, error)
- func (d *Manage) CreateTable(user, db, sql string, table *meta.Table) (id string, rows uint64, err error)
- func (d *Manage) DropDatabase(uname, database string) (id string, rows uint64, err error)
- func (d *Manage) DropTable(user, db string, t *meta.Table) (id string, rows uint64, err error)
- func (d *Manage) GetTaskStatus(uname, id string) (TasksStatus, error)
- func (d *Manage) Run()
- func (d *Manage) SendTask(t *Task, result *Result) error
- type Map
- type Plan
- type Result
- type SubPlan
- type Task
- type TaskStatus
- type TasksStatus
- type Wait
- type Waitter
Constants ¶
View Source
const ( // CreateDB is the type of the create database plan CreateDB = "CreateDB" // CreateTable is the type of the create table plan CreateTable = "CreateTable" )
View Source
const ( Pending = "wait" Doing = "doing" Done = "done" Fail = "fail" )
View Source
const ( StatusLock = "lock" StatusUnlock = "unlock" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DDL ¶
type DDL interface { CreateDatabase(uname, database string, num int) (id string, rows uint64, err error) CreateTable(user, db, sql string, t *meta.Table) (id string, rows uint64, err error) DropTable(user, db string, t *meta.Table) (id string, rows uint64, err error) DropDatabase(uname, database string) (id string, rows uint64, err error) }
DDL is responsible for schema change.
type DDLLock ¶
type DDLLock struct { Key string Version int64 ID string // contains filtered or unexported fields }
DDLLock is a rambo lock
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock include a lock and refer count
type Manage ¶
type Manage struct {
// contains filtered or unexported fields
}
Manage manage handle all ddl stmt
func (*Manage) BecomeMaster ¶
BecomeMaster is election's callback method
func (*Manage) CallUnLock ¶
CallUnLock will lock key specific source
func (*Manage) CreateDatabase ¶
CreateDatabase will create a new database for the uname's user
func (*Manage) CreateTable ¶
func (d *Manage) CreateTable(user, db, sql string, table *meta.Table) (id string, rows uint64, err error)
CreateTable get a CreateTable task IMPORTANT: only support hash type yet!!!
func (*Manage) DropDatabase ¶
DropDatabase get a DropDatabase task
func (*Manage) GetTaskStatus ¶
func (d *Manage) GetTaskStatus(uname, id string) (TasksStatus, error)
GetTaskStatus will get task's status
type Plan ¶
type Plan struct { SubPlans []*SubPlan `json:"sub-plans"` LockVersion int64 `json:"lock-version"` ID string `json:"id"` // uuid LockKey string `json:"lock-key"` DBName string `json:"db-name"` UserName string `json:"user-name"` Table *meta.Table `json:"table"` FinishNodes []*meta.Backend `json:"finish-nodes"` }
Plan is ddl execute plan
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is the result of rpc
type SubPlan ¶
type SubPlan struct { SubDatabase *meta.Backend `json:"backend"` IsDB bool `json:"is-db"` SQL string `json:"sql"` }
SubPlan is one of ddl's sub plans
type TaskStatus ¶
type TasksStatus ¶
type TasksStatus map[string]*TaskStatus
TasksStatus is task's status
func NewTasksStatus ¶
func NewTasksStatus() TasksStatus
NewTasksStatus return a new TasksStatus instance
type Wait ¶
Wait is default Waitter impl
Click to show internal directories.
Click to hide internal directories.