types

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Factory = map[Kind]CreateFn{}

Functions

func MustRegister

func MustRegister(kind Kind, create CreateFn)

MustRegister panic if register failed.

func Register

func Register(kind Kind, create CreateFn) error

Register add an executor's create function.

Types

type ActionExecutor

type ActionExecutor interface {
	Kind() Kind
	Name() Name

	// Exist 返回 created, started, error
	Exist(ctx context.Context, action *spec.PipelineTask) (created bool, started bool, err error)
	// Create 保证幂等
	Create(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	// Start 保证幂等
	Start(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	Update(ctx context.Context, action *spec.PipelineTask) (interface{}, error)

	// Status 只做简单重试
	Status(ctx context.Context, action *spec.PipelineTask) (apistructs.PipelineStatusDesc, error)
	Inspect(ctx context.Context, action *spec.PipelineTask) (apistructs.TaskInspect, error)

	Cancel(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	Remove(ctx context.Context, action *spec.PipelineTask) (interface{}, error)
	BatchDelete(ctx context.Context, actions []*spec.PipelineTask) (interface{}, error)
}

type CreateFn

type CreateFn func(name Name, options map[string]string) (ActionExecutor, error)

Create be used to create an action executor instance.

type Kind

type Kind string

Kind represents an executor's type.

func (Kind) String

func (s Kind) String() string

func (Kind) Validate

func (s Kind) Validate() bool

type Name

type Name string

Name represents an executor's name.

func (Name) String

func (s Name) String() string

func (Name) Validate

func (s Name) Validate() bool

Jump to

Keyboard shortcuts

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