Documentation ¶
Index ¶
- Variables
- func DelAllDroppedColumns(ctx context.Context, kvClient metaModel.KVClient) error
- type ClusterInfo
- type ClusterInfoStore
- func (f ClusterInfoStore) Delete(ctx context.Context) error
- func (f ClusterInfoStore) Get(ctx context.Context) (state, error)
- func (f ClusterInfoStore) Put(ctx context.Context, state state) error
- func (clusterInfoStore *ClusterInfoStore) UpdateVersion(ctx context.Context, newVer semver.Version) error
- type DDLItem
- type DDLType
- type DroppedColumns
- type DroppedColumnsStore
- func (s *DroppedColumnsStore) AddDroppedColumns(ctx context.Context, cols []string, sourceTable SourceTable) error
- func (s *DroppedColumnsStore) DelDroppedColumn(ctx context.Context, col string) error
- func (s *DroppedColumnsStore) DelDroppedColumnForTable(ctx context.Context, sourceTable SourceTable) error
- func (f DroppedColumnsStore) Delete(ctx context.Context) error
- func (f DroppedColumnsStore) Get(ctx context.Context) (state, error)
- func (s *DroppedColumnsStore) HasDroppedColumn(ctx context.Context, col string, sourceTable SourceTable) bool
- func (f DroppedColumnsStore) Put(ctx context.Context, state state) error
- type FinishedTaskStatus
- type Job
- type JobStore
- func (f JobStore) Delete(ctx context.Context) error
- func (f JobStore) Get(ctx context.Context) (state, error)
- func (jobStore *JobStore) GetJobCfg(ctx context.Context) (*config.JobCfg, error)
- func (jobStore *JobStore) MarkDeleting(ctx context.Context) error
- func (f JobStore) Put(ctx context.Context, state state) error
- func (jobStore *JobStore) UpdateConfig(ctx context.Context, jobCfg *config.JobCfg) error
- func (jobStore *JobStore) UpdateStages(ctx context.Context, taskIDs []string, stage TaskStage) error
- func (jobStore *JobStore) UpgradeFuncs() []bootstrap.UpgradeFunc
- type MetaData
- type SourceTable
- type Store
- type TargetTable
- type Task
- type TaskStage
- type TaskStatus
- type UnitState
- type UnitStateStore
- type UnitStatus
Constants ¶
This section is empty.
Variables ¶
var ErrStateNotFound = errors.New("state not found")
ErrStateNotFound is returned when the state is not found in metadata.
Functions ¶
Types ¶
type ClusterInfo ¶
ClusterInfo represents the cluster info.
func NewClusterInfo ¶
func NewClusterInfo(version semver.Version) *ClusterInfo
NewClusterInfo creates a new ClusterInfo instance.
type ClusterInfoStore ¶
type ClusterInfoStore struct {
// contains filtered or unexported fields
}
ClusterInfoStore manages the state of ClusterInfo.
func NewClusterInfoStore ¶
func NewClusterInfoStore(kvClient metaModel.KVClient) *ClusterInfoStore
NewClusterInfoStore returns a new ClusterInfoStore instance
func (*ClusterInfoStore) UpdateVersion ¶
func (clusterInfoStore *ClusterInfoStore) UpdateVersion(ctx context.Context, newVer semver.Version) error
UpdateVersion updates the version of ClusterInfo.
type DDLItem ¶
type DDLItem struct { TargetTable TargetTable SourceTable SourceTable // Tables is the table stmts in order before and after the DDL executed Tables []string DDLs []string Type DDLType }
DDLItem represents a DDL item
type DroppedColumns ¶
type DroppedColumns struct { // column -> source table Cols map[string]map[SourceTable]struct{} }
DroppedColumns represents the state of dropped columns
type DroppedColumnsStore ¶
type DroppedColumnsStore struct {
// contains filtered or unexported fields
}
DroppedColumnsStore manages the dropped columns state
func NewDroppedColumnsStore ¶
func NewDroppedColumnsStore(kvClient metaModel.KVClient, targetTable TargetTable) *DroppedColumnsStore
NewDroppedColumnsStore returns a new DroppedColumnsStore instance
func (*DroppedColumnsStore) AddDroppedColumns ¶
func (s *DroppedColumnsStore) AddDroppedColumns(ctx context.Context, cols []string, sourceTable SourceTable) error
AddDroppedColumns adds dropped columns to the state
func (*DroppedColumnsStore) DelDroppedColumn ¶
func (s *DroppedColumnsStore) DelDroppedColumn(ctx context.Context, col string) error
DelDroppedColumn deletes dropped column from the state
func (*DroppedColumnsStore) DelDroppedColumnForTable ¶
func (s *DroppedColumnsStore) DelDroppedColumnForTable(ctx context.Context, sourceTable SourceTable) error
DelDroppedColumnForTable deletes dropped column for one source table
func (*DroppedColumnsStore) HasDroppedColumn ¶
func (s *DroppedColumnsStore) HasDroppedColumn(ctx context.Context, col string, sourceTable SourceTable) bool
HasDroppedColumn returns whether the column is dropped before
type FinishedTaskStatus ¶
type FinishedTaskStatus struct { TaskStatus Result *pb.ProcessResult Status json.RawMessage Duration time.Duration }
FinishedTaskStatus wraps the TaskStatus with FinishedStatus. It only used when a task is finished.
type Job ¶
type Job struct { // taskID -> task Tasks map[string]*Task // Deleting represents whether the job is being deleted. Deleting bool }
Job represents the state of a job.
type JobStore ¶
type JobStore struct { *bootstrap.DefaultUpgrader // contains filtered or unexported fields }
JobStore manages the state of a job.
func NewJobStore ¶
NewJobStore creates a new JobStore instance
func (*JobStore) MarkDeleting ¶
MarkDeleting marks the job as deleting.
func (*JobStore) UpdateConfig ¶
UpdateConfig will be called if user update job config.
func (*JobStore) UpdateStages ¶
func (jobStore *JobStore) UpdateStages(ctx context.Context, taskIDs []string, stage TaskStage) error
UpdateStages will be called if user operate job.
func (*JobStore) UpgradeFuncs ¶
func (jobStore *JobStore) UpgradeFuncs() []bootstrap.UpgradeFunc
UpgradeFuncs implement the Upgrader interface.
type MetaData ¶
type MetaData struct {
// contains filtered or unexported fields
}
MetaData is the metadata of dm.
func NewMetaData ¶
NewMetaData creates a new MetaData instance
func (*MetaData) ClusterInfoStore ¶
func (m *MetaData) ClusterInfoStore() *ClusterInfoStore
ClusterInfoStore returns internal infoStore
func (*MetaData) UnitStateStore ¶
func (m *MetaData) UnitStateStore() *UnitStateStore
UnitStateStore returns internal unitStateStore
type SourceTable ¶
SourceTable represents a upstream table
func (SourceTable) MarshalText ¶
func (st SourceTable) MarshalText() (text []byte, err error)
MarshalText implements json.MarshalText.
func (*SourceTable) UnmarshalText ¶
func (st *SourceTable) UnmarshalText(text []byte) error
UnmarshalText implements json.UnmarshalText.
type Store ¶
type Store interface { Put(ctx context.Context, state state) error Delete(ctx context.Context) error Get(ctx context.Context) (state, error) }
Store holds one state instance.
type TargetTable ¶
TargetTable represents a downstream table.
func (TargetTable) MarshalText ¶
func (tt TargetTable) MarshalText() (text []byte, err error)
MarshalText implements json.MarshalText.
func (*TargetTable) UnmarshalText ¶
func (tt *TargetTable) UnmarshalText(text []byte) error
UnmarshalText implements json.UnmarshalText.
type Task ¶
Task is the minimum working unit of a job. A job may contain multiple upstream and it will be converted into multiple tasks.
type TaskStage ¶
type TaskStage int
TaskStage represents internal stage of a task. TODO: use Stage in lib or move Stage to lib. we need to use same value for stage with same name in dmpb.Stage in order to make grafana dashboard label correct, since we use the same grafana dashboard for OP and engine. there's no need for them to have same meaning, just for grafana display.
const ( StageInit TaskStage = iota + 1 // = 1 = dmpb.Stage_New StageRunning // = 2 = dmpb.Stage_Running StagePaused // = 3 ~= dmpb.Stage_Paused. in engine this stage means paused by user, if it's auto-paused by error, it's StageError StageFinished TaskStage = iota + 2 // = 5 = dmpb.Stage_Finished. skip 4 - Stopped, no such stage in engine, see dm/worker/metrics.go StagePausing // = 6 = dmpb.Stage_Pausing StageError TaskStage = iota + 10 // = 15, leave some value space for extension of dmpb.Stage // StageUnscheduled means the task is not scheduled. // This usually happens when the worker is offline. StageUnscheduled )
These stages may be updated in later pr.
func (TaskStage) MarshalJSON ¶
MarshalJSON marshals the enum as a quoted json string
func (*TaskStage) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the enum value
type TaskStatus ¶
type TaskStatus struct { Unit frameModel.WorkerType Task string Stage TaskStage CfgModRevision uint64 StageUpdatedTime time.Time }
TaskStatus defines the running task status.
type UnitState ¶
type UnitState struct { // taskID -> sequence of finished status FinishedUnitStatus map[string][]*FinishedTaskStatus CurrentUnitStatus map[string]*UnitStatus }
UnitState represents the state of units.
type UnitStateStore ¶
type UnitStateStore struct {
// contains filtered or unexported fields
}
UnitStateStore is the meta store for UnitState.
func NewUnitStateStore ¶
func NewUnitStateStore(kvClient metaModel.KVClient) *UnitStateStore
NewUnitStateStore creates a new UnitStateStore.
func (*UnitStateStore) ReadModifyWrite ¶
func (f *UnitStateStore) ReadModifyWrite( ctx context.Context, action func(*UnitState) error, ) error
ReadModifyWrite reads the state, modifies it, and writes it back.
type UnitStatus ¶
type UnitStatus struct { Unit frameModel.WorkerType Task string CreatedTime time.Time }
UnitStatus defines the unit status.