task

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 6 Imported by: 4 modules, 30 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseTask

type BaseTask struct {
	FailureCount   int    // Failed executions count
	Name           string // hook name
	Type           TaskType
	Binding        hook.BindingType
	BindingContext []hook.BindingContext
	Delay          time.Duration
	AllowFailure   bool // Task considered as 'ok' if hook failed. False by default. Can be true for some schedule hooks.
}

func NewTask

func NewTask(taskType TaskType, name string) *BaseTask

func NewTaskDelay

func NewTaskDelay(delay time.Duration) *BaseTask

func (*BaseTask) AppendBindingContext

func (t *BaseTask) AppendBindingContext(context hook.BindingContext) *BaseTask

func (*BaseTask) DumpAsText

func (t *BaseTask) DumpAsText() string

func (*BaseTask) GetAllowFailure

func (t *BaseTask) GetAllowFailure() bool

func (*BaseTask) GetBinding

func (t *BaseTask) GetBinding() hook.BindingType

func (*BaseTask) GetBindingContext

func (t *BaseTask) GetBindingContext() []hook.BindingContext

func (*BaseTask) GetDelay

func (t *BaseTask) GetDelay() time.Duration

func (*BaseTask) GetFailureCount

func (t *BaseTask) GetFailureCount() int

func (*BaseTask) GetName

func (t *BaseTask) GetName() string

func (*BaseTask) GetType

func (t *BaseTask) GetType() TaskType

func (*BaseTask) IncrementFailureCount

func (t *BaseTask) IncrementFailureCount()

func (*BaseTask) WithAllowFailure

func (t *BaseTask) WithAllowFailure(allowFailure bool) *BaseTask

func (*BaseTask) WithBinding

func (t *BaseTask) WithBinding(binding hook.BindingType) *BaseTask

func (*BaseTask) WithBindingContext

func (t *BaseTask) WithBindingContext(context []hook.BindingContext) *BaseTask

type FailureCountIncrementable

type FailureCountIncrementable interface {
	IncrementFailureCount()
}

type Task

type Task interface {
	GetName() string
	GetType() TaskType
	GetBinding() hook.BindingType
	GetBindingContext() []hook.BindingContext
	GetFailureCount() int
	IncrementFailureCount()
	GetDelay() time.Duration
	GetAllowFailure() bool
}

type TaskType

type TaskType string
const (
	// a task to run a particular hook
	HookRun TaskType = "TASK_HOOK_RUN"

	// queue control tasks
	Delay TaskType = "TASK_DELAY"
	Stop  TaskType = "TASK_STOP"

	// Exit a program
	Exit TaskType = "TASK_EXIT"
)

type TasksQueue

type TasksQueue struct {
	*queue.Queue
}

func NewTasksQueue

func NewTasksQueue() *TasksQueue

func (*TasksQueue) Add

func (tq *TasksQueue) Add(task Task)

func (*TasksQueue) DumpReader

func (tq *TasksQueue) DumpReader() io.Reader

прочитать дамп структуры для сохранения во временный файл

func (*TasksQueue) IncrementFailureCount

func (tq *TasksQueue) IncrementFailureCount()

func (*TasksQueue) Peek

func (tq *TasksQueue) Peek() (task Task, err error)

func (*TasksQueue) Push

func (tq *TasksQueue) Push(task Task)

type TextDumper

type TextDumper interface {
	DumpAsText() string
}

Jump to

Keyboard shortcuts

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