cdule

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JobRegistry = make(map[string]reflect.Type)

JobRegistry job registry

View Source
var ScheduleParser cron.Parser

ScheduleParser cron parser

View Source
var WorkerID string

WorkerID string

Functions

This section is empty.

Types

type AbstractJob

type AbstractJob struct {
	Job     Job
	JobData map[string]string
}

AbstractJob for holding job and jobdata

func NewJob

func NewJob(job Job, jobData map[string]string) *AbstractJob

NewJob to create new abstract job

func (*AbstractJob) Build

func (j *AbstractJob) Build(cronExpression string) (*model.Job, error)

Build to build job and store in the database

type Cdule

type Cdule struct {
	*WorkerWatcher
	*ScheduleWatcher
}

Cdule holds watcher objects

func (*Cdule) NewCdule

func (cdule *Cdule) NewCdule(param ...string)

NewCdule to create new scheduler with default worker name as hostname

func (*Cdule) NewCduleWithWorker

func (cdule *Cdule) NewCduleWithWorker(workerName string, param ...string)

NewCduleWithWorker to create new scheduler with worker

func (Cdule) StopWatcher

func (cdule Cdule) StopWatcher()

StopWatcher to stop watchers

type Job

type Job interface {
	Execute(map[string]string)
	JobName() string
	GetJobData() map[string]string
}

Job interface

type ScheduleWatcher

type ScheduleWatcher struct {
	Closed chan struct{}
	WG     sync.WaitGroup
	Ticker *time.Ticker
}

ScheduleWatcher struct

func (*ScheduleWatcher) Run

func (t *ScheduleWatcher) Run()

Run to run watcher in a continuous loop

func (*ScheduleWatcher) Stop

func (t *ScheduleWatcher) Stop()

Stop to stop scheduler watcher

type WorkerJobCount

type WorkerJobCount struct {
	WorkerID string `json:"worker_id"`
	Count    int64  `json:"count"`
}

WorkerJobCount struct

type WorkerWatcher

type WorkerWatcher struct {
	Closed chan struct{}
	WG     sync.WaitGroup
	Ticker *time.Ticker
}

WorkerWatcher struct

func (*WorkerWatcher) Run

func (t *WorkerWatcher) Run()

Run to run watcher in a continuous loop

func (*WorkerWatcher) Stop

func (t *WorkerWatcher) Stop()

Stop to stop worker watcher

Jump to

Keyboard shortcuts

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