admin

package
v3.1.22 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTask

func CreateTask(ctx context.Context, task *Task) error

CreateTask creates a task on database

func FinishMigrateTask

func FinishMigrateTask(ctx context.Context, task *Task) error

FinishMigrateTask updates database when migrate task finished

func IsErrTaskDoesNotExist

func IsErrTaskDoesNotExist(err error) bool

IsErrTaskDoesNotExist checks if an error is a ErrTaskDoesNotExist.

Types

type ErrTaskDoesNotExist

type ErrTaskDoesNotExist struct {
	ID     int64
	RepoID int64
	Type   structs.TaskType
}

ErrTaskDoesNotExist represents a "TaskDoesNotExist" kind of error.

func (ErrTaskDoesNotExist) Error

func (err ErrTaskDoesNotExist) Error() string

func (ErrTaskDoesNotExist) Unwrap

func (err ErrTaskDoesNotExist) Unwrap() error

type Task

type Task struct {
	ID             int64
	DoerID         int64                  `xorm:"index"` // operator
	Doer           *user_model.User       `xorm:"-"`
	OwnerID        int64                  `xorm:"index"` // repo owner id, when creating, the repoID maybe zero
	Owner          *user_model.User       `xorm:"-"`
	RepoID         int64                  `xorm:"index"`
	Repo           *repo_model.Repository `xorm:"-"`
	Type           structs.TaskType
	Status         structs.TaskStatus `xorm:"index"`
	StartTime      timeutil.TimeStamp
	EndTime        timeutil.TimeStamp
	PayloadContent string             `xorm:"TEXT"`
	Message        string             `xorm:"TEXT"` // if task failed, saved the error reason, it could be a JSON string of TranslatableMessage or a plain message
	Created        timeutil.TimeStamp `xorm:"created"`
}

Task represents a task

func GetMigratingTask

func GetMigratingTask(ctx context.Context, repoID int64) (*Task, error)

GetMigratingTask returns the migrating task by repo's id

func (*Task) LoadDoer

func (task *Task) LoadDoer(ctx