execution

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Execution

type Execution struct {
	ID                string                 `hash:"-"`
	EventID           string                 `hash:"eventID"`
	Status            Status                 `hash:"-"`
	Service           *service.Service       `hash:"service"`
	TaskKey           string                 `hash:"taskKey"`
	Tags              []string               `hash:"tags"`
	Inputs            map[string]interface{} `hash:"inputs"`
	OutputKey         string                 `hash:"-"`
	OutputData        map[string]interface{} `hash:"-"`
	CreatedAt         time.Time              `hash:"-"`
	ExecutedAt        time.Time              `hash:"-"`
	ExecutionDuration time.Duration          `hash:"-"`
}

Execution stores all informations about executions.

func New added in v0.4.0

func New(service *service.Service, eventID string, taskKey string, inputs map[string]interface{}, tags []string) (*Execution, error)

New returns a new execution. It returns an error if inputs are invalid.

func (*Execution) Complete

func (execution *Execution) Complete(outputKey string, outputData map[string]interface{}) error

Complete changes execution status to completed. It verifies the output. It returns an error if the status is different then InProgress or verification fails.

func (*Execution) Execute

func (execution *Execution) Execute() error

Execute changes executions status to in progres and update its execute time. It returns an error if the status is different then Created.

type Status added in v0.4.0

type Status int

Status stores the state of an execution

const (
	Created Status = iota
	InProgress
	Completed
)

Status for an execution Created => The execution is created but not yet processed InProgress => The execution is being processed Completed => The execution is completed

type StatusError added in v0.4.0

type StatusError struct {
	ExpectedStatus Status
	ActualStatus   Status
}

StatusError is an error when the processing is done on en execution with the wrong status

func (StatusError) Error added in v0.4.0

func (e StatusError) Error() string

Error returns the string representation of error.

Jump to

Keyboard shortcuts

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