tests

package
v0.0.0-...-b044761 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var O = Order{}

O order

Functions

This section is empty.

Types

type Order

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

Order is used for recording execution order

func (*Order) Clear

func (o *Order) Clear()

Clear the order

func (*Order) Get

func (o *Order) Get() []string

Get order

func (*Order) GetFirst

func (o *Order) GetFirst() time.Time

GetFirst time

func (*Order) GetLast

func (o *Order) GetLast() time.Time

GetLast time

func (*Order) IsFirstZero

func (o *Order) IsFirstZero() bool

IsFirstZero check if first is zero time

func (*Order) Push

func (o *Order) Push(s string)

Push an execution id

func (*Order) SetFirst

func (o *Order) SetFirst(t time.Time)

SetFirst time

func (*Order) SetLast

func (o *Order) SetLast(t time.Time)

SetLast time

type RetryTask

type RetryTask struct {
	RetryCount int64
	MaxRetry   int64
	// contains filtered or unexported fields
}

RetryTask implements task.Interface However it has no export field, which is not able to be scheduled by sched

func NewRetryTask

func NewRetryTask(id string, e time.Time, maxRetry int64) *RetryTask

NewRetryTask creates a task

func (*RetryTask) Execute

func (t *RetryTask) Execute() (result interface{}, retry bool, fail error)

Execute is the actual execution block

func (*RetryTask) GetExecution

func (t *RetryTask) GetExecution() (execute time.Time)

GetExecution get execution time

func (*RetryTask) GetID

func (t *RetryTask) GetID() (id string)

GetID get task id

func (*RetryTask) GetRetryTime

func (t *RetryTask) GetRetryTime() time.Time

GetRetryTime get retry execution duration

func (*RetryTask) GetTimeout

func (t *RetryTask) GetTimeout() (executeTimeout time.Duration)

GetTimeout get timeout of execution

func (*RetryTask) IsValidID

func (t *RetryTask) IsValidID() bool

IsValidID check id is valid

func (*RetryTask) SetExecution

func (t *RetryTask) SetExecution(current time.Time) time.Time

SetExecution sets the execution time of a task

func (*RetryTask) SetID

func (t *RetryTask) SetID(id string)

SetID sets the id of a task

type Task

type Task struct {
	Public string
	// contains filtered or unexported fields
}

Task implements task.Interface

func NewTask

func NewTask(id string, e time.Time) *Task

NewTask creates a task

func (*Task) Execute

func (t *Task) Execute() (result interface{}, retry bool, fail error)

Execute is the actual execution block

func (*Task) GetExecution

func (t *Task) GetExecution() (execute time.Time)

GetExecution get execution time

func (*Task) GetID

func (t *Task) GetID() (id string)

GetID get task id

func (*Task) GetRetryTime

func (t *Task) GetRetryTime() time.Time

GetRetryTime get retry execution duration

func (*Task) GetTimeout

func (t *Task) GetTimeout() (executeTimeout time.Duration)

GetTimeout get timeout of execution

func (*Task) IsValidID

func (t *Task) IsValidID() bool

IsValidID check id is valid

func (*Task) SetExecution

func (t *Task) SetExecution(current time.Time) (old time.Time)

SetExecution sets the execution time of a task

func (*Task) SetID

func (t *Task) SetID(id string)

SetID sets the id of a task

Jump to

Keyboard shortcuts

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