services

package
v0.0.0-...-3f08e25 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryService

type CategoryService interface {
	// 创建分类
	Create(category *datamodels.Category) (*datamodels.Category, error)
	// 保存分类
	Save(category *datamodels.Category) (*datamodels.Category, error)
	// 根据ID获取分类
	GetByID(id int64) (category *datamodels.Category, err error)
	// 根据Name获取分类
	GetByName(name string) (category *datamodels.Category, err error)
	// 根据ID或者Name获取分类
	GetByIdORName(idOrName string) (category *datamodels.Category, err error)
	// 获取分类的列表
	List(offset int, limit int) (categories []*datamodels.Category, err error)
	// 删除分类
	Delete(category *datamodels.Category) (err error)
	// 更新分类
	Update(category *datamodels.Category, fields map[string]interface{}) (*datamodels.Category, error)
	// 更新分类
	UpdateByID(id int64, fields map[string]interface{}) (*datamodels.Category, error)
	// 获取分类的jobs列表
	GetJobsList(category *datamodels.Category, offset int, limit int) (jobs []*datamodels.Job, err error)
}

Category Service Interface

func NewCategoryService

func NewCategoryService(repo repositories.CategoryRepository) CategoryService

实例化Category Service

type JobExecuteService

type JobExecuteService interface {
	// 创建JobExecute
	Create(jobExecute *datamodels.JobExecute) (*datamodels.JobExecute, error)
	// 根据ID获取JobExecute
	GetByID(id int64) (jobExecute *datamodels.JobExecute, err error)
	// 获取JobExecute的列表
	List(offset int, limit int) (jobExecutes []*datamodels.JobExecute, err error)
	// 更新
	Update(jobExecute *datamodels.JobExecute, fields map[string]interface{}) (*datamodels.JobExecute, error)
	// 根据ID更新
	UpdateByID(id int64, fields map[string]interface{}) (jobExecute *datamodels.JobExecute, err error)

	// 回写执行结果信息
	SaveExecuteLog(jobExecuteResult *datamodels.JobExecuteResult) (jobExecute *datamodels.JobExecute, err error)

	// 获取JobExecute的Log
	GetExecuteLog(jobExecute *datamodels.JobExecute) (jobExecuteLog *datamodels.JobExecuteLog, err error)
	GetExecuteLogByID(id int64) (jobExecuteLog *datamodels.JobExecuteLog, err error)
	// Kill Job Execute
	KillByID(id int64) (success bool, err error)
}

JobExecute Service Interface

type JobKillService

type JobKillService interface {
	// 创建JobKill
	Create(jobKill *datamodels.JobKill) (*datamodels.JobKill, error)
	// 保存JobKill
	Save(jobKill *datamodels.JobKill) (*datamodels.JobKill, error)
	// 根据ID获取JobKill
	GetByID(id int64) (jobKill *datamodels.JobKill, err error)
	// 获取JobKill的列表
	List(offset int, limit int) (jobKills []*datamodels.JobKill, err error)
	// 设置JobKill为完成
	SetFinishedByID(id int64) (jobKill *datamodels.JobKill, err error)
}

type JobService

type JobService interface {
	// 创建Job
	Create(job *datamodels.Job) (*datamodels.Job, error)
	// 保存Job
	Save(job *datamodels.Job) (*datamodels.Job, error)
	// 根据ID获取Job
	GetByID(id int64) (job *datamodels.Job, err error)
	// 根据分类和ID获取分类
	// 获取Job的列表
	List(offset int, limit int) (jobs []*datamodels.Job, err error)
	// 删除Job
	Delete(job *datamodels.Job) (err error)
	// 更新Job
	Update(job *datamodels.Job, fields map[string]interface{}) (*datamodels.Job, error)
	// 更新Job
	UpdateByID(id int64, fields map[string]interface{}) (*datamodels.Job, error)
	// 根据ID或者Name获取分类
	GetCategoryByIDOrName(idOrName string) (category *datamodels.Category, err error)
	// 获取Job的执行列表
	GetJobExecuteList(jobID int64, offset int, limit int) (jobExecutes []*datamodels.JobExecute, err error)
}

Job Service Interface

func NewJobService

func NewJobService(repo repositories.JobRepository) JobService

实例化Job Service

type LockService

type LockService interface {
	// 创建、抢锁
	Create(name string, ttl int64) (lock *datamodels.Lock, err error)
	// 对锁续租: 后续会添加密码校验
	Lease(leaseID int64, password string) error
	// 删除锁: 释放租约
	Release(leaseID int64, password string) error
}

Lock Service

func NewLockService

func NewLockService(repo repositories.LockRepository) LockService

实例化LockService

type WorkerService

type WorkerService interface {
	// 创建Worker
	Create(worker *datamodels.Worker) (*datamodels.Worker, error)
	// 获取Worker
	Get(name string) (worker *datamodels.Worker, err error)
	// 删除Worker
	Delete(worker *datamodels.Worker) (success bool, err error)
	DeleteByName(name string) (success bool, err error)
	// 工作节点的列表
	List() (workersList []*datamodels.Worker, err error)
}

Jump to

Keyboard shortcuts

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