log

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExecRunning = "running"
	ExecFail    = "fail"
	ExecCancel  = "cancel"
	ExecSuccess = "success"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GetLogRequest

type GetLogRequest struct {
	Id *uint32 `json:"id"`
}

type ListLogRequest

type ListLogRequest struct {
	Page     uint32  `json:"page"`
	PageSize uint32  `json:"pageSize"`
	TaskId   uint32  `json:"taskId"`
	Order    *string `json:"order"`
	OrderBy  *string `json:"orderBy"`
}

type Log

type Log struct {
	Id             uint32 `json:"id"`
	Uuid           string `json:"uuid"`
	WorkerId       uint32 `json:"workerId"`
	WorkerSnapshot string `json:"workerSnapshot"`
	TaskId         uint32 `json:"taskId"`
	TaskSnapshot   string `json:"taskSnapshot"`
	StartAt        int64  `json:"startAt"`
	EndAt          int64  `json:"endAt"`
	Content        string `json:"content"`
	Status         string `json:"status"`
}

type Repo

type Repo interface {
	// GetLog 获取指定的日志信息
	GetLog(ctx kratosx.Context, id uint32) (*Log, error)

	// ListLog 获取日志信息列表
	ListLog(ctx kratosx.Context, req *ListLogRequest) ([]*Log, uint32, error)

	// CreateLog 创建日志信息
	CreateLog(ctx kratosx.Context, req *Log) (uint32, error)

	// DeleteLog 删除日志信息
	DeleteLog(ctx kratosx.Context, ids []uint32) (uint32, error)

	// IsRunning 任务是否还在执行
	IsRunning(ctx kratosx.Context, uuid string) bool

	// AppendLogContent 追加日志内容
	AppendLogContent(ctx kratosx.Context, uuid string, c string) error

	// UpdateLogStatus 更新日志状态
	UpdateLogStatus(ctx kratosx.Context, uuid string, err error) error

	// CancelTaskByUUID 取消任务通过uuid
	CancelTaskByUUID(ctx kratosx.Context, uuid string) error

	// GetTargetIpByUuid 获取指定任务的执行节点ip
	GetTargetIpByUuid(ctx kratosx.Context, uuid string) (string, error)
}

type UseCase

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

func NewUseCase

func NewUseCase(config *conf.Config, repo Repo) *UseCase

func (*UseCase) CreateLog

func (u *UseCase) CreateLog(ctx kratosx.Context, req *Log) (uint32, error)

CreateLog 创建日志信息

func (*UseCase) DeleteLog

func (u *UseCase) DeleteLog(ctx kratosx.Context, ids []uint32) (uint32, error)

DeleteLog 删除日志信息

func (*UseCase) GetLog

func (u *UseCase) GetLog(ctx kratosx.Context, req *GetLogRequest) (*Log, error)

GetLog 获取指定的日志信息

func (*UseCase) ListLog

func (u *UseCase) ListLog(ctx kratosx.Context, req *ListLogRequest) ([]*Log, uint32, error)

ListLog 获取日志信息列表

Jump to

Keyboard shortcuts

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