service

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MaxJobCount = 10000

Variables

View Source
var DefaultJobService = new(JobService)
View Source
var DefaultScriptService = new(ScriptService)
View Source
var DefaultUserService = new(UserService)

Functions

func GetNodeSystemInfo

func GetNodeSystemInfo(uuid string) (s *utils.Server, err error)

func RegisterTables

func RegisterTables(db *gorm.DB) error

func RunLogCleaner

func RunLogCleaner(cleanPeriod time.Duration, expiration int64) (close chan struct{})

Types

type JobService

type JobService struct {
}

func (*JobService) AutoAllocateNode

func (j *JobService) AutoAllocateNode() string

Give priority to the node with the least number of tasks

func (*JobService) GetJobExcCount

func (j *JobService) GetJobExcCount(start, end int64, success int) ([]resp.DateCount, error)

The number of tasks per day in a certain period of time

func (*JobService) GetNotAssignedJob

func (j *JobService) GetNotAssignedJob() (jobs []models.Job, err error)

func (*JobService) GetRunningJobCount

func (j *JobService) GetRunningJobCount() (int64, error)

func (*JobService) GetTodayJobExcCount

func (j *JobService) GetTodayJobExcCount(success int) (int64, error)

Get the total number of tasks executed today 1 indicates success 0 indicates failure

func (*JobService) Once

func (j *JobService) Once(once *request.ReqJobOnce) (err error)

func (*JobService) Search

func (j *JobService) Search(s *request.ReqJobSearch) ([]models.Job, int64, error)

func (*JobService) SearchJobLog

func (j *JobService) SearchJobLog(s *request.ReqJobLogSearch) ([]models.JobLog, int64, error)

type NodeWatcherService

type NodeWatcherService struct {
	// contains filtered or unexported fields
}
var DefaultNodeWatcher *NodeWatcherService

func NewNodeWatcherService

func NewNodeWatcherService() *NodeWatcherService

func (*NodeWatcherService) Close

func (n *NodeWatcherService) Close() error

func (*NodeWatcherService) FailOver

func (n *NodeWatcherService) FailOver(nodeUUID string) (success Result, fail Result, err error)

func (*NodeWatcherService) GetJobCount

func (n *NodeWatcherService) GetJobCount(nodeUUID string) (int, error)

func (*NodeWatcherService) GetJobs

func (n *NodeWatcherService) GetJobs(nodeUUID string) (jobs []models.Job, err error)

get all the job under a node

func (*NodeWatcherService) GetNodeCount

func (n *NodeWatcherService) GetNodeCount(status int) (int64, error)

func (*NodeWatcherService) GetUUID

func (n *NodeWatcherService) GetUUID(key string) string

func (*NodeWatcherService) List2Array

func (n *NodeWatcherService) List2Array() []string

func (*NodeWatcherService) Search

func (*NodeWatcherService) Watch

func (n *NodeWatcherService) Watch() error

type Result

type Result []int

func (Result) Count

func (r Result) Count() (count int)

func (Result) String

func (r Result) String() (str string)

type ScriptService

type ScriptService struct {
}

func (*ScriptService) Search

func (script *ScriptService) Search(s *request.ReqScriptSearch) ([]models.Script, int64, error)

type UserService

type UserService struct {
}

func (*UserService) ChangePassword

func (us *UserService) ChangePassword(userId int, oldPassword, newPassword string) error

func (*UserService) FindByUserName

func (us *UserService) FindByUserName(username string) (u *models.User, err error)

func (*UserService) Login

func (us *UserService) Login(username, password string) (u *models.User, err error)

func (*UserService) Search

func (us *UserService) Search(s *request.ReqUserSearch) ([]models.User, int64, error)

Jump to

Keyboard shortcuts

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