task

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const LogEndFlag = "-[EOF]-"

Variables

View Source
var ErrReachedLogEnd = errors.New("reached log end")

Functions

func GetPolymorphicValue

func GetPolymorphicValue(taskType dvmodel.TaskType) string

Types

type ConcreteTask

type ConcreteTask interface {
	FindOneById(id int64) (*dvmodel.DeployTask, error)
	Create(tx *gorm.DB, data map[string]any) (id int64, err error)
	Update(tx *gorm.DB, data map[string]any, id int64) error
	Delete(tx *gorm.DB, t *dvmodel.Task) error
	Start(ctx context.Context, t *dvmodel.Task) error
	Run(ctx context.Context, t *dvmodel.Task) error
	Stop(ctx context.Context, t *dvmodel.Task) error
}

func Select

func Select(taskType dvmodel.TaskType) ConcreteTask

type DeployTaskService

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

func (*DeployTaskService) Create

func (s *DeployTaskService) Create(tx *gorm.DB, data map[string]any) (int64, error)

func (*DeployTaskService) Delete

func (s *DeployTaskService) Delete(tx *gorm.DB, t *dvmodel.Task) error

func (*DeployTaskService) FindOneById

func (s *DeployTaskService) FindOneById(id int64) (*dvmodel.DeployTask, error)

func (*DeployTaskService) Run

func (*DeployTaskService) Start

func (s *DeployTaskService) Start(ctx context.Context, t *dvmodel.Task) error

func (*DeployTaskService) Stop

func (*DeployTaskService) Update

func (s *DeployTaskService) Update(tx *gorm.DB, data map[string]any, id int64) error

type LogService

type LogService struct {
}

func GetTaskLogService

func GetTaskLogService() *LogService

func (*LogService) IsLogEnd

func (s *LogService) IsLogEnd(line string) bool

func (*LogService) OpenHostLogFile

func (s *LogService) OpenHostLogFile(taskId int64, host string, hostLogName string) (*os.File, error)

func (*LogService) OpenLatestManifestLogFile

func (s *LogService) OpenLatestManifestLogFile(taskId int64) (*os.File, error)

func (*LogService) ParseManifestEntry

func (s *LogService) ParseManifestEntry(entryLine string) (*ManifestEntry, error)

type ManifestEntry

type ManifestEntry struct {
	Index       int    `json:"index"`       // 序号
	Time        string `json:"time"`        // 时间
	Host        string `json:"host"`        // 主机地址(IP)
	HostLogName string `json:"hostLogName"` // 主机日志名称
	Status      string `json:"status"`      // 执行状态,成功、失败等
}

type TaskService

type TaskService struct {
}

func GetTaskService

func GetTaskService() *TaskService

func (*TaskService) CreateTask

func (s *TaskService) CreateTask(info *req.TaskUpsertReq) error

func (*TaskService) DeleteTask

func (s *TaskService) DeleteTask(id int64) error

func (*TaskService) FindOneById

func (s *TaskService) FindOneById(id int64) (*dvmodel.Task, error)

func (*TaskService) PageList

func (s *TaskService) PageList(keyword string, page, pageSize int) (*res.PageableData[*dvRes.TaskRes], error)

func (*TaskService) StartTask

func (s *TaskService) StartTask(uId, id int64) error

func (*TaskService) StopTask

func (s *TaskService) StopTask(id int64) error

func (*TaskService) UpdateTask

func (s *TaskService) UpdateTask(id int64, info *req.TaskUpsertReq) error

Jump to

Keyboard shortcuts

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