task

package
v0.0.0-...-13edf00 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearTaskManager

func ClearTaskManager(localLog zerolog.Logger)

func GetTaskManagerTime

func GetTaskManagerTime() time.Time

func WithRecurringFunctionTaskInterval

func WithRecurringFunctionTaskInterval(interval time.Duration) func(*RecurringFunctionTask)

func WithRecurringTaskInterval

func WithRecurringTaskInterval(interval time.Duration) GenericApplier[*RecurringTask]

func WithRecurringTaskOffset

func WithRecurringTaskOffset(offset time.Duration) GenericApplier[*RecurringTask]

func WithTaskTime

func WithTaskTime(taskTime time.Time) GenericApplier[*Task]

Types

type InstallTaskOptions

type InstallTaskOptions struct {
	When     *time.Time
	Delta    *time.Duration
	Interval *time.Duration
	Offset   *time.Duration
}

func WithInstallTaskOptionsDelta

func WithInstallTaskOptionsDelta(delta time.Duration) InstallTaskOptions

func WithInstallTaskOptionsInterval

func WithInstallTaskOptionsInterval(interval time.Duration) InstallTaskOptions

func WithInstallTaskOptionsNone

func WithInstallTaskOptionsNone() InstallTaskOptions

func WithInstallTaskOptionsOffset

func WithInstallTaskOptionsOffset(offset time.Duration) InstallTaskOptions

func WithInstallTaskOptionsWhen

func WithInstallTaskOptionsWhen(when time.Time) InstallTaskOptions

func (InstallTaskOptions) WithDelta

func (InstallTaskOptions) WithInterval

func (i InstallTaskOptions) WithInterval(interval time.Duration) InstallTaskOptions

func (InstallTaskOptions) WithOffset

func (i InstallTaskOptions) WithOffset(offset time.Duration) InstallTaskOptions

func (InstallTaskOptions) WithWhen

type OneShotDeleteTask

type OneShotDeleteTask struct {
	*Task
}

func NewOneShotDeleteTask

func NewOneShotDeleteTask(taskRequirements TaskRequirements, options ...Option) *OneShotDeleteTask

func (*OneShotDeleteTask) IsOneShotDeleteTask

func (r *OneShotDeleteTask) IsOneShotDeleteTask() bool

func (*OneShotDeleteTask) Serialize

func (d *OneShotDeleteTask) Serialize() ([]byte, error)

func (*OneShotDeleteTask) SerializeWithWriteBuffer

func (d *OneShotDeleteTask) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*OneShotDeleteTask) String

func (d *OneShotDeleteTask) String() string

type OneShotFunctionTask

type OneShotFunctionTask struct {
	*OneShotDeleteTask
	// contains filtered or unexported fields
}

func FunctionTask

func FunctionTask(fn GenericFunction, args Args, kwArgs KWArgs) *OneShotFunctionTask

func OneShotFunction

func OneShotFunction(fn GenericFunction, args Args, kwArgs KWArgs) *OneShotFunctionTask

func (*OneShotFunctionTask) ProcessTask

func (m *OneShotFunctionTask) ProcessTask() error

func (*OneShotFunctionTask) Serialize

func (d *OneShotFunctionTask) Serialize() ([]byte, error)

func (*OneShotFunctionTask) SerializeWithWriteBuffer

func (d *OneShotFunctionTask) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*OneShotFunctionTask) String

func (d *OneShotFunctionTask) String() string

type OneShotTask

type OneShotTask struct {
	*Task
}

func NewOneShotTask

func NewOneShotTask(taskRequirements TaskRequirements, options ...Option) *OneShotTask

func (*OneShotTask) Serialize

func (d *OneShotTask) Serialize() ([]byte, error)

func (*OneShotTask) SerializeWithWriteBuffer

func (d *OneShotTask) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*OneShotTask) String

func (d *OneShotTask) String() string

type RecurringFunctionTask

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

func NewRecurringFunctionTask

func NewRecurringFunctionTask(localLog zerolog.Logger, fn GenericFunction, args Args, kwArgs KWArgs, options ...Option) *RecurringFunctionTask

func (*RecurringFunctionTask) ProcessTask

func (r *RecurringFunctionTask) ProcessTask() error

func (*RecurringFunctionTask) String

func (r *RecurringFunctionTask) String() string

type RecurringTask

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

func NewRecurringTask

func NewRecurringTask(localLog zerolog.Logger, taskRequirements TaskRequirements, options ...Option) *RecurringTask

func (*RecurringTask) GetDebugAttr

func (r *RecurringTask) GetDebugAttr(attr string) any

func (*RecurringTask) InstallTask

func (r *RecurringTask) InstallTask(options InstallTaskOptions)

func (*RecurringTask) IsRecurringTask

func (r *RecurringTask) IsRecurringTask() bool

type Task

type Task struct {
	*DebugContents   `ignore:"true"`
	TaskRequirements `ignore:"true"`
	// contains filtered or unexported fields
}

func NewTask

func NewTask(taskRequirements TaskRequirements, options ...Option) *Task

func (*Task) GetDebugAttr

func (t *Task) GetDebugAttr(attr string) any

func (*Task) GetIsScheduled

func (t *Task) GetIsScheduled() bool

func (*Task) GetLeafName

func (t *Task) GetLeafName() string

func (*Task) GetTaskTime

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

func (*Task) InstallTask

func (t *Task) InstallTask(options InstallTaskOptions)

func (*Task) Resume

func (t *Task) Resume()

func (*Task) Serialize

func (d *Task) Serialize() ([]byte, error)

func (*Task) SerializeWithWriteBuffer

func (d *Task) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Task) SetIsScheduled

func (t *Task) SetIsScheduled(isScheduled bool)

func (*Task) String

func (d *Task) String() string

func (*Task) SuspendTask

func (t *Task) SuspendTask()

type TaskManager

type TaskManager interface {
	fmt.Stringer
	GetTime() time.Time
	InstallTask(task TaskRequirements)
	SuspendTask(task TaskRequirements)
	ResumeTask(task TaskRequirements)
	GetNextTask() (TaskRequirements, *time.Duration)
	ProcessTask(task TaskRequirements)
	GetTasks() []TaskRequirements
	PopTask() TaskRequirements
	CountTasks() int
	ClearTasks()
}

func GetTaskManager deprecated

func GetTaskManager() TaskManager

Deprecated: should only be used by core... find a better way

func NewTaskManager

func NewTaskManager(localLog zerolog.Logger) TaskManager

func OverwriteTaskManager

func OverwriteTaskManager(localLog zerolog.Logger, manager TaskManager) (oldManager TaskManager)

type TaskRequirements

type TaskRequirements interface {
	fmt.Stringer
	ProcessTask() error
	InstallTask(options InstallTaskOptions)
	GetTaskTime() *time.Time
	GetIsScheduled() bool
	SetIsScheduled(isScheduled bool)
}

Jump to

Keyboard shortcuts

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