commander

package
v0.0.0-...-c266f6d Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug() map[string]interface{}

func SetupSchedule

func SetupSchedule()

Types

type CheckJob

type CheckJob struct {
	Name string
	Spec string
	// contains filtered or unexported fields
}

*

  • 服务存活检查任务

func NewCheckJob

func NewCheckJob(name string, spec string) *CheckJob

func (*CheckJob) Run

func (j *CheckJob) Run()

type CommanderServer

type CommanderServer struct {
	pb.UnimplementedCommanderServer
}

func NewCommanderServer

func NewCommanderServer() *CommanderServer

func (*CommanderServer) UpdateCron

func (commander *CommanderServer) UpdateCron(ctx context.Context, req *pb.Cron) (*pb.CronRes, error)

type CrawJob

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

func NewCrawJob

func NewCrawJob(site *dto.Site) *CrawJob

func (*CrawJob) Run

func (j *CrawJob) Run()

type Schedule

type Schedule struct {
	// 定时任务
	JobCron *cron.Cron
	// 全局变量
	JobMap sync.Map
	// contains filtered or unexported fields
}
var (
	JobSchedule Schedule

	Pool = rpc.RpcPool{
		Clients: make(map[string]*rpc.RpcClient),
		Lock:    sync.RWMutex{},
	}
)

func (*Schedule) AddJob

func (s *Schedule) AddJob(name string, spec string, job cron.Job) error

func (*Schedule) InitJobs

func (s *Schedule) InitJobs() error

func (*Schedule) RemoveJob

func (s *Schedule) RemoveJob(name string) bool

func (*Schedule) TruncateJobs

func (s *Schedule) TruncateJobs() error

func (*Schedule) UpdateJob

func (s *Schedule) UpdateJob(name string, spec string, job cron.Job) bool

Jump to

Keyboard shortcuts

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