pointcron

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CloseTimeout time.Duration
	TickTime     time.Duration
}

type PointJob

type PointJob interface {
	Close() error
	GetLastAccessed() time.Time
}

type PointScheduler

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

func NewPointScheduler

func NewPointScheduler(config Config) *PointScheduler

func (*PointScheduler) Enqueue

func (p *PointScheduler) Enqueue(point PointJob)

func (*PointScheduler) IsRunning

func (p *PointScheduler) IsRunning() bool

IsRunning returns true if the scheduler is running

func (*PointScheduler) SetMaxConcurrentJobs

func (p *PointScheduler) SetMaxConcurrentJobs(n int)

SetMaxConcurrentJobs limits how many jobs can be running at the same time. This is useful when running resource intensive jobs and a precise start time is not critical.

func (*PointScheduler) StartAsync

func (p *PointScheduler) StartAsync()

StartAsync starts all jobs without blocking the current thread

func (*PointScheduler) StartBlocking

func (p *PointScheduler) StartBlocking()

StartBlocking starts all jobs and blocks the current thread. This blocking method can be stopped with Stop() from a separate goroutine.

type State

type State int64
const (
	STALE State = iota
	RUNNING
)

Jump to

Keyboard shortcuts

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