task

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const PluginTypeTask plugin.Type = "task"

Variables

This section is empty.

Functions

func NewCmdCfg

func NewCmdCfg() *cmd.Cfg

func RegisterCollector

func RegisterCollector(typ Type, c Collector)

Types

type BaseStep

type BaseStep struct {
	runner.Runner
	// contains filtered or unexported fields
}

func (*BaseStep) GetCfg

func (b *BaseStep) GetCfg() interface{}

func (*BaseStep) GetTask

func (b *BaseStep) GetTask() *Task

func (*BaseStep) SetTask

func (b *BaseStep) SetTask(t *Task)

func (*BaseStep) Store added in v0.0.3

func (b *BaseStep) Store(k string, v any)

func (*BaseStep) Type

func (b *BaseStep) Type() interface{}

type Cfg

type Cfg struct {
	ID              string     `json:"id"              validate:"required,min=1" yaml:"id"`
	Type            Type       `json:"type"            yaml:"type"`
	Steps           []*StepCfg `json:"steps"           validate:"required,min=1" yaml:"steps"`
	DeferSteps      []*StepCfg `json:"deferSteps"      yaml:"deferSteps"`
	CurStepIdx      int        `json:"curStepIdx"      yaml:"curStepIdx"`
	CurDeferStepIdx int        `json:"curDeferStepIdx" yaml:"curDeferStepIdx"`
}

func NewCfg

func NewCfg() *Cfg

func (*Cfg) Add

func (c *Cfg) Add(typ StepType, cfg interface{}) *Cfg

func (*Cfg) Defer

func (c *Cfg) Defer(typ StepType, cfg interface{}) *Cfg

func (*Cfg) SetID

func (c *Cfg) SetID(id string) *Cfg

func (*Cfg) SetType

func (c *Cfg) SetType(t Type) *Cfg

type Cmd

type Cmd struct {
	Step
	*cmd.Cfg
	// contains filtered or unexported fields
}

func NewCmdStep

func NewCmdStep() *Cmd

func (*Cmd) GetCfg

func (c *Cmd) GetCfg() interface{}

func (*Cmd) Init

func (c *Cmd) Init() error

func (*Cmd) Start

func (c *Cmd) Start() error

func (*Cmd) Stop

func (c *Cmd) Stop() error

func (*Cmd) Type

func (c *Cmd) Type() interface{}

type Collector

type Collector func(*Task) interface{}

type Snapshot

type Snapshot struct {
	Cfg              *Cfg                `json:"cfg"              yaml:"cfg"`
	StepsResult      []map[string]string `json:"stepsResult"      yaml:"stepsResult"`
	DeferStepsResult []map[string]string `json:"deferStepsResult" yaml:"deferStepsResult"`
}

type Step

type Step interface {
	runner.Runner
	plugin.Plugin
	GetTask() *Task
	SetTask(*Task)
	CollectAsString() map[string]string
}

func NewBase

func NewBase(name string) Step

type StepCfg

type StepCfg struct {
	Type StepType    `json:"type" validate:"required" yaml:"type"`
	Cfg  interface{} `json:"cfg"  validate:"required" yaml:"cfg"`
}

type StepDoneHook

type StepDoneHook func(*Task, int, Step)

type StepType

type StepType string
const StepTypeCmd StepType = "cmd"

type Task

type Task struct {
	runner.Runner
	plugin.Plugin
	*Cfg
	// contains filtered or unexported fields
}

func New

func New() *Task

func (*Task) CurDeferStep

func (t *Task) CurDeferStep() Step

func (*Task) CurStep

func (t *Task) CurStep() Step

func (*Task) DeferSteps

func (t *Task) DeferSteps() []Step

func (*Task) GetCfg added in v0.0.3

func (t *Task) GetCfg() interface{}

func (*Task) Init

func (t *Task) Init() error

func (*Task) RegisterDeferStepDoneHook

func (t *Task) RegisterDeferStepDoneHook(hook ...StepDoneHook)

func (*Task) RegisterStepDoneHook

func (t *Task) RegisterStepDoneHook(hook ...StepDoneHook)

func (*Task) Result

func (t *Task) Result() interface{}

func (*Task) Snapshot

func (t *Task) Snapshot() *Snapshot

func (*Task) Start

func (t *Task) Start() error

func (*Task) Steps

func (t *Task) Steps() []Step

func (*Task) Stop

func (t *Task) Stop() error

func (*Task) Store added in v0.0.3

func (t *Task) Store(k string, v any)

func (*Task) Type added in v0.0.3

func (t *Task) Type() interface{}

type Type

type Type string

Jump to

Keyboard shortcuts

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