xcron

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 任务锁
	WorkerLockDir       = "/xcron/lock/"
	DefaultTTL          = 60   // default set
	DefaultWaitLockTime = 1000 // ms
)

Variables

View Source
var (
	// Every ...
	Every = cron.Every
	// NewParser ...
	NewParser = cron.NewParser
	// NewChain ...
	NewChain = cron.NewChain
	// WithSeconds ...
	WithSeconds = cron.WithSeconds
	// WithParser ...
	WithParser = cron.WithParser
	// WithLocation ...
	WithLocation = cron.WithLocation
)

Functions

This section is empty.

Types

type Config

type Config struct {
	WithSeconds     bool
	ConcurrentDelay int
	ImmediatelyRun  bool

	// Distributed task
	DistributedTask bool

	WaitLockTime time.Duration
	*etcdv3.Config
	// contains filtered or unexported fields
}

Config ...

func DefaultConfig

func DefaultConfig() Config

DefaultConfig ...

func RawConfig

func RawConfig(key string) Config

RawConfig ...

func StdConfig

func StdConfig(name string) Config

StdConfig ...

func (Config) Build

func (config Config) Build() *Cron

Build ...

func (*Config) WithChain

func (config *Config) WithChain(wrappers ...JobWrapper) Config

WithChain ...

func (*Config) WithLogger

func (config *Config) WithLogger(logger *xlog.Logger) Config

WithLogger ...

func (*Config) WithParser

func (config *Config) WithParser(parser Parser) Config

WithParser ...

type Cron

type Cron struct {
	*Config
	*cron.Cron
	// contains filtered or unexported fields
}

Cron ...

func (*Cron) AddFunc

func (c *Cron) AddFunc(spec string, cmd func() error) (EntryID, error)

AddFunc ...

func (*Cron) AddJob

func (c *Cron) AddJob(spec string, cmd NamedJob) (EntryID, error)

AddJob ...

func (*Cron) GetEntryByName

func (c *Cron) GetEntryByName(name string) cron.Entry

GetEntryByName ...

func (*Cron) Run

func (c *Cron) Run() error

Run ...

func (*Cron) Schedule

func (c *Cron) Schedule(schedule Schedule, job NamedJob) EntryID

Schedule ...

func (*Cron) Stop

func (c *Cron) Stop() error

Stop ...

type Entry

type Entry = cron.Entry

Entry ...

type EntryID

type EntryID = cron.EntryID

EntryID ...

type FuncJob

type FuncJob func() error

FuncJob ...

func (FuncJob) Name

func (f FuncJob) Name() string

Name ...

func (FuncJob) Run

func (f FuncJob) Run() error

Run ...

type Job

type Job = cron.Job

Job ...

type JobWrapper

type JobWrapper = cron.JobWrapper

JobWrapper ...

type NamedJob

type NamedJob interface {
	Run() error
	Name() string
}

NamedJob ..

type Option

type Option = cron.Option

Option ...

type Parser

type Parser = cron.Parser

Parser ...

type Schedule

type Schedule = cron.Schedule

Schedule ...

Jump to

Keyboard shortcuts

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