service

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

func New

func New(kv *redis.Client, db *gorm.DB, rest *resty.Client, log *zap.SugaredLogger) *Service

New create a job service instance

func (*Service) AgentAdd

func (s *Service) AgentAdd(uid string, info *types.AgentBasic) (*types.Agent, error)

AgentAdd create a server side agent

func (*Service) AgentAvailable added in v1.2.5

func (s *Service) AgentAvailable(aid string)

func (*Service) AgentDelete

func (s *Service) AgentDelete(aid string) error

func (*Service) AgentOffline

func (s *Service) AgentOffline(aid string)

AgentOffline will call after the watcher found agent status switch to offline

func (*Service) AgentOnline

func (s *Service) AgentOnline(aid, uid, ip string)

AgentOnline will call after every agent job pull

func (*Service) AgentSecret

func (s *Service) AgentSecret(aid string) (string, error)

func (*Service) AgentSecretReset

func (s *Service) AgentSecretReset(aid string) (string, error)

func (*Service) AgentUnavailable added in v1.2.5

func (s *Service) AgentUnavailable(aid string)

func (*Service) AuthValidator

func (s *Service) AuthValidator(key string, c echo.Context) (bool, error)

func (*Service) DelayedJobAdd added in v1.2.0

func (s *Service) DelayedJobAdd(aid, uid string, job *types.DelayedJobInput) error

func (*Service) DelayedJobCheck added in v1.2.0

func (s *Service) DelayedJobCheck()

DelayedJobCheck find jobs need to run, put the to cloud

func (*Service) FindAgent

func (s *Service) FindAgent(aid string) (*types.Agent, error)

func (*Service) FindUserAgentByName

func (s *Service) FindUserAgentByName(uid, name string) (id string, ok bool, err error)

func (*Service) IsAgentOnline

func (s *Service) IsAgentOnline(aid string) bool

func (*Service) Job added in v0.6.0

func (s *Service) Job(id string) (*types.Job, error)

func (*Service) JobAdd added in v0.8.2

func (s *Service) JobAdd(uid, text, source, callback string) error

JobAdd is different from JobPush, text contain agent name as first field.

func (*Service) JobCancel

func (s *Service) JobCancel(id string)

JobCancel Agent offline will cancel all job in queue

func (*Service) JobExpire

func (s *Service) JobExpire(id string)

func (*Service) JobFail

func (s *Service) JobFail(id string, result string) error

func (*Service) JobPop

func (s *Service) JobPop(aid string) *types.JobBasic

JobPop call by agent, so will not return errors, notify the error to admin.

func (*Service) JobPush

func (s *Service) JobPush(input *types.JobInput) error

JobPush call by upstream system

func (*Service) JobRunning added in v0.6.0

func (s *Service) JobRunning(id string, message string) error

func (*Service) JobSucceed

func (s *Service) JobSucceed(id string, result string) error

func (*Service) UserAgents

func (s *Service) UserAgents(uid string) ([]*types.Agent, error)

UserAgents return user's all agent

func (*Service) UserSetting added in v1.2.4

func (s *Service) UserSetting(uid string) (*types.UserSetting, error)

Jump to

Keyboard shortcuts

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