redcron

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 15 Imported by: 0

Documentation

Overview

Package redcron is distributed timers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(r *Request)

Option is parameter.

func WithSpec

func WithSpec(spec string) Option

WithSpec modifies the timer time description.

func WithTRPCOption

func WithTRPCOption(trpcOptions ...client.Option) Option

WithTRPCOption adds trpc option。

type RedCron

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

RedCron is distributed timing task object.

func New

func New(cmdable redis.Cmdable, opts ...cron.Option) (*RedCron, error)

New creates a new distributed scheduled task object.

func (*RedCron) AddFunc

func (c *RedCron) AddFunc(name string, f filter.ClientHandleFunc, opts ...Option) (cron.EntryID, error)

AddFunc adds tasks through functions. If target does not exist, it means that the scheduled task will not be executed, and EntryID=0 will be returned.

func (*RedCron) Start

func (c *RedCron) Start()

Start starts the timer.

func (*RedCron) Stop

func (c *RedCron) Stop()

Stop stops the timer.

type Request

type Request struct {
	EntryID cron.EntryID // Timing task ID.
	Spec    string       // cron timing time description string.
	// contains filtered or unexported fields
}

Request is filter request body.

type Response

type Response struct {
	IsRun        bool      // Whether to be executed.
	NotRunReason string    // Reason for not running.
	Now          time.Time // Current time
	Store        time.Time // Redis stores time.
	Prev         time.Time // Current timer execution time.
	Next         time.Time // The next execution time of the timer.
	Cas          int64     // Redis CAS is convenient for locating problems.
	LastErr      error     // Last error.
}

Response is the filter response body.

Jump to

Keyboard shortcuts

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