routine

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayTask

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

DelayTask represents a timeout task

func NewDelayTask

func NewDelayTask(cb Task, d time.Duration) *DelayTask

NewDelayTask creates an instance of DelayTask

func (*DelayTask) Start

func (t *DelayTask) Start(ctx context.Context) error

Start executes the delayed task after given timeout.

func (*DelayTask) Stop

func (t *DelayTask) Stop(ctx context.Context) error

Stop stops the timeout

type RecurringTask

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

RecurringTask represents a recurring task

func NewRecurringTask

func NewRecurringTask(t Task, i time.Duration) *RecurringTask

NewRecurringTask creates an instance of RecurringTask

func (*RecurringTask) Start

func (t *RecurringTask) Start(ctx context.Context) error

Start starts the timer

func (*RecurringTask) Stop

func (t *RecurringTask) Stop(_ context.Context) error

Stop stops the timer

type Task

type Task func()

Task is the task logic to run.

Jump to

Keyboard shortcuts

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