iotex-core: github.com/iotexproject/iotex-core/pkg/routine Index | Files

package routine

import "github.com/iotexproject/iotex-core/pkg/routine"

Index

Package Files

delaytask.go options.go recurringtask.go task.go

func WithClock Uses

func WithClock(c clock.Clock) interface {
    RecurringTaskOption
    DelayTaskOption
}

WithClock set a clock to a task.

type DelayTask Uses

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

DelayTask represents a timeout task

func NewDelayTask Uses

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

NewDelayTask creates an instance of DelayTask

func (*DelayTask) Start Uses

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

Start executes the delayed task after given timeout.

func (*DelayTask) Stop Uses

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

Stop stops the timeout

type DelayTaskOption Uses

type DelayTaskOption interface {
    SetDelayTaskOption(*DelayTask)
}

DelayTaskOption is option to DelayTask.

type RecurringTask Uses

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

RecurringTask represents a recurring task

func NewRecurringTask Uses

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

NewRecurringTask creates an instance of RecurringTask

func (*RecurringTask) Start Uses

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

Start starts the timer

func (*RecurringTask) Stop Uses

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

Stop stops the timer

type RecurringTaskOption Uses

type RecurringTaskOption interface {
    SetRecurringTaskOption(*RecurringTask)
}

RecurringTaskOption is option to RecurringTask.

type Task Uses

type Task func()

Task is the task logic to run.

Package routine imports 4 packages (graph) and is imported by 3 packages. Updated 2019-08-19. Refresh now. Tools for package owners.