mysql

package
v0.0.0-...-12cef5b Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToPreempt = errors.New("抢占失败")
	ErrTaskNotHold     = errors.New("未持有任务")
)

Functions

func NewGormExecutionDAO

func NewGormExecutionDAO(db *gorm.DB) storage.ExecutionDAO

Types

type Execution

type Execution struct {
	ID  int64 `gorm:"primary_key;auto_increment"`
	Tid int64
	// 任务执行进度
	Progress uint8
	Status   uint8
	Ctime    int64
	Utime    int64
}

Execution 任务执行记录

func (Execution) TableName

func (Execution) TableName() string

type GormExecutionDAO

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

func (*GormExecutionDAO) Create

func (h *GormExecutionDAO) Create(ctx context.Context, tid int64) (int64, error)

func (*GormExecutionDAO) GetLastExecution

func (h *GormExecutionDAO) GetLastExecution(ctx context.Context, tid int64) (task.Execution, error)

func (*GormExecutionDAO) ToDomain

func (h *GormExecutionDAO) ToDomain(e Execution) task.Execution

func (*GormExecutionDAO) Update

func (h *GormExecutionDAO) Update(ctx context.Context, eid int64, status task.ExecStatus, progress int) error

func (*GormExecutionDAO) Upsert

func (h *GormExecutionDAO) Upsert(ctx context.Context, id int64, status task.ExecStatus, progress uint8) (int64, error)

type GormTaskCfgRepository

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

func NewGormTaskCfgRepository

func NewGormTaskCfgRepository(db *gorm.DB) *GormTaskCfgRepository

func (*GormTaskCfgRepository) Add

func (*GormTaskCfgRepository) Stop

func (g *GormTaskCfgRepository) Stop(ctx context.Context, id int64) error

func (*GormTaskCfgRepository) UpdateNextTime

func (g *GormTaskCfgRepository) UpdateNextTime(ctx context.Context, id int64, next time.Time) error

type Preempter

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

func NewPreempter

func NewPreempter(db *gorm.DB, batchSize int, refreshInterval time.Duration) *Preempter

func (*Preempter) Preempt

func (p *Preempter) Preempt(ctx context.Context) (preempt.TaskLeaser, error)

type TaskInfo

type TaskInfo struct {
	ID   int64 `gorm:"primary_key;auto_increment"`
	Name string
	// 任务类型
	Type         string
	Cron         string
	Executor     string
	Owner        string
	Status       int8
	Cfg          string
	NextExecTime int64
	Ctime        int64
	Utime        int64
}

func (TaskInfo) TableName

func (TaskInfo) TableName() string

Directories

Path Synopsis
Package daomysqlmocks is a generated GoMock package.
Package daomysqlmocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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