cron

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MulanPSL-2.0 Imports: 9 Imported by: 0

README

gsf-cron

cron config json

{
  "resize_enable" : 1,
  "channel_buffer" : 100,
  "resize_duration" : 1800,
  "resize_threshold_ratio" : 3,
  "resize_threshold_limit" : 5000,
  "resize_threshold_times" : 3
}
--cron-resize-enable value           cron resize enable (default: 1)
--cron-channel-buffer value          cron change event channel buffer size (default: 100)
--cron-resize-duration value         cron resize duration (default: 1800)
--cron-resize-threshold-ratio value  cron resize threshold ratio(cap/len > ratio) (default: 3)
--cron-resize-threshold-limit value  cron resize threshold max size(cap-len > max size) (default: 3000)
--cron-resize-threshold-times value  cron resize threshold hold times (default: 3)

Documentation

Index

Constants

View Source
const (
	ScheduleEventAdd    = 1
	ScheduleEventChange = 2
	ScheduleEventRemove = 3
	ScheduleEventResize = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	Cfg ComponentConfig
	// contains filtered or unexported fields
}

func (*Component) CliFlags

func (s *Component) CliFlags() []cli.Flag

func (*Component) Close

func (s *Component) Close() error

func (*Component) FreeCron

func (s *Component) FreeCron(name string) error

func (*Component) Init

func (s *Component) Init(_ logger.Interface, _ *gsf.AppConfig, _ *cli.Context) error

func (*Component) NewCron

func (s *Component) NewCron(name string) (*Cron, error)

func (*Component) NewCronEx

func (s *Component) NewCronEx(name string, bSize int) (*Cron, error)

func (*Component) Run

func (s *Component) Run() error

type ComponentConfig added in v0.3.0

type ComponentConfig struct {
	ResizeEnable         int `json:"resize_enable"          yaml:"resize_enable"`
	ChannelBuffer        int `json:"channel_buffer"         yaml:"channel_buffer"`
	ResizeDuration       int `json:"resize_duration"        yaml:"resize_duration"`
	ResizeThresholdRatio int `json:"resize_threshold_ratio" yaml:"resize_threshold_ratio"`
	ResizeThresholdLimit int `json:"resize_threshold_limit" yaml:"resize_threshold_limit"`
	ResizeThresholdTimes int `json:"resize_threshold_times" yaml:"resize_threshold_times"`
}

type Cron added in v0.3.0

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

func NewCron added in v0.3.0

func NewCron(h Resize, chgBuff int) *Cron

func (*Cron) AddFunc added in v0.3.0

func (s *Cron) AddFunc(name string, sch schedule.Interface, cmd ScheduleRun)

func (*Cron) AddJob added in v0.3.0

func (s *Cron) AddJob(name string, sch schedule.Interface, cmd Job)

func (*Cron) AddScheduleJob added in v0.3.0

func (s *Cron) AddScheduleJob(name string, cmd ScheduleJob)

func (*Cron) Entries added in v0.3.0

func (s *Cron) Entries() entries

func (*Cron) Entry added in v0.3.0

func (s *Cron) Entry(name string) *entry

func (*Cron) Job added in v0.3.0

func (s *Cron) Job(name string) ScheduleJob

func (*Cron) Remove added in v0.3.0

func (s *Cron) Remove(name string)

func (*Cron) Resize added in v0.3.0

func (s *Cron) Resize()

func (*Cron) Start added in v0.3.0

func (s *Cron) Start()

func (*Cron) Stop added in v0.3.0

func (s *Cron) Stop()

type Job added in v0.3.0

type Job interface {
	Init()
	Run(time.Time)
	Destroy()
}

type Resize

type Resize interface {
	Check(cap, len int) bool
	NewCap(len int) int
}

type ResizeIterm added in v0.3.0

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

func (*ResizeIterm) Check added in v0.3.0

func (r *ResizeIterm) Check(cap, len int) bool

func (*ResizeIterm) NewCap added in v0.3.0

func (r *ResizeIterm) NewCap(len int) int

type ScheduleJob added in v0.3.0

type ScheduleJob interface {
	schedule.Interface
	Job
}

type ScheduleRun added in v0.3.0

type ScheduleRun func(t time.Time)

type WrapJob added in v0.3.0

type WrapJob ScheduleRun

func (WrapJob) Destroy added in v0.3.0

func (f WrapJob) Destroy()

func (WrapJob) Init added in v0.3.0

func (f WrapJob) Init()

func (WrapJob) Run added in v0.3.0

func (f WrapJob) Run(t time.Time)

type WrapScheduleJob added in v0.3.0

type WrapScheduleJob struct {
	Job
	schedule.Interface
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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