gcron

package
v0.0.0-...-04ff805 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DurCron

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

Equal duration cron, it's concurrent-safe.

func NewDurCron

func NewDurCron(origin *time.Time, returnTrueFirstCheck bool, d time.Duration) *DurCron

NewDurCron creates new DurCron object. The origin is calc origin time, if it's nil, time.Now() used as origin. The d is cron interval.

func (*DurCron) CheckNowUnblock

func (c *DurCron) CheckNowUnblock() (triggerCount int, trigger bool)

CheckNowUnblock returns true when now is a trigger point, otherwise false. Backlog trigger point history will be ignored, it just return latest trigger point.

type NtpCron

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

func NewNtpCronONLINE

func NewNtpCronONLINE(ntpClock *gtime.NtpClock, triggerTime time.Time) (*NtpCron, error)

func NewNtpCronWithClock

func NewNtpCronWithClock(ntpClock *gtime.NtpClock, triggerTime time.Time) (*NtpCron, error)

func (*NtpCron) Wait

func (sc *NtpCron) Wait()

type RateLimiter

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

func NewRateLimiter

func NewRateLimiter(d time.Duration) *RateLimiter

func NewRateLimiterEx

func NewRateLimiterEx(d time.Duration, c gtime.Clock) *RateLimiter

func (*RateLimiter) Get

func (r *RateLimiter) Get() time.Duration

func (*RateLimiter) MarkAndWaitBlock

func (r *RateLimiter) MarkAndWaitBlock()

func (*RateLimiter) MarkAndWaitUnblock

func (r *RateLimiter) MarkAndWaitUnblock() bool

type RateLimiterPriority

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

func NewRateLimiterPriority

func NewRateLimiterPriority(d time.Duration) *RateLimiterPriority

func (*RateLimiterPriority) Duration

func (r *RateLimiterPriority) Duration() time.Duration

func (*RateLimiterPriority) TakeWait

func (r *RateLimiterPriority) TakeWait(priority uint)

mark and wait block

type SysCron

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

func NewSysCron

func NewSysCron(triggerTime time.Time) (*SysCron, error)

func (*SysCron) Wait

func (sc *SysCron) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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