task

package
v1.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 8 Imported by: 2 modules, 4 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 // Module or hook name
	Type           TaskType
	Binding        module_manager.BindingType
	BindingContext []module_manager.BindingContext
	Delay          time.Duration
	AllowFailure   bool // Task considered as 'ok' if hook failed. False by default. Can be true for some schedule hooks.

	OnStartupHooks bool // Run module onStartup hooks on Addon-operator startup or on module enabled.
}

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 module_manager.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() module_manager.BindingType

func (*BaseTask) GetBindingContext

func (t *BaseTask) GetBindingContext() []module_manager.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) GetOnStartupHooks

func (t *BaseTask) GetOnStartupHooks() bool

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 module_manager.BindingType) *BaseTask

func (*BaseTask) WithBindingContext

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

func (*BaseTask) WithOnStartupHooks

func (t *BaseTask) WithOnStartupHooks(onStartupHooks bool) *BaseTask

type FailureCountIncrementable

type FailureCountIncrementable interface {
	IncrementFailureCount()
}

type Task added in v1.7.0

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

type TaskType

type TaskType string
const (
	ModuleDelete         TaskType = "TASK_MODULE_DELETE"
	ModuleRun            TaskType = "TASK_MODULE_RUN"
	ModuleHookRun        TaskType = "TASK_MODULE_HOOK_RUN"
	GlobalHookRun        TaskType = "TASK_GLOBAL_HOOK_RUN"
	DiscoverModulesState TaskType = "TASK_DISCOVER_MODULES_STATE"
	// удаление релиза без сведений о модуле
	ModulePurge TaskType = "TASK_MODULE_PURGE"
	// retry module_manager-а
	ModuleManagerRetry TaskType = "TASK_MODULE_MANAGER_RETRY"
	// вспомогательные задачи: задержка и остановка обработки
	Delay TaskType = "TASK_DELAY"
	Stop  TaskType = "TASK_STOP"
)

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 TasksQueueDumper

type TasksQueueDumper struct {
	DumpFilePath string
	// contains filtered or unexported fields
}

func NewTasksQueueDumper

func NewTasksQueueDumper(dumpFilePath string, queue *TasksQueue) *TasksQueueDumper

func (*TasksQueueDumper) DumpQueue

func (t *TasksQueueDumper) DumpQueue()

func (*TasksQueueDumper) QueueChangeCallback

func (t *TasksQueueDumper) QueueChangeCallback()

QueueChangeCallback dumps a queue to a dump file when queue changes.

func (*TasksQueueDumper) WatchQueue

func (t *TasksQueueDumper) WatchQueue()

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