execution

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Status_name = map[int32]string{
	0: "Unknown",
	1: "Created",
	2: "InProgress",
	3: "Completed",
	4: "Failed",
}
View Source
var Status_value = map[string]int32{
	"Unknown":    0,
	"Created":    1,
	"InProgress": 2,
	"Completed":  3,
	"Failed":     4,
}

Functions

This section is empty.

Types

type ByBlockHeight added in v0.19.0

type ByBlockHeight []*Execution

ByBlockHeight implements sort.Interface for []*Execution based on the block height field.

func (ByBlockHeight) Len added in v0.19.0

func (a ByBlockHeight) Len() int

func (ByBlockHeight) Less added in v0.19.0

func (a ByBlockHeight) Less(i, j int) bool

func (ByBlockHeight) Swap added in v0.19.0

func (a ByBlockHeight) Swap(i, j int)

type Execution

type Execution struct {
	// Hash is a unique hash to identify execution.
	Hash github_com_mesg_foundation_engine_hash.Hash `protobuf:"bytes,1,opt,name=hash,proto3,customtype=github.com/mesg-foundation/engine/hash.Hash" json:"hash" hash:"-"`
	// parentHash is the unique hash of parent execution.
	// if execution is triggered by another one,
	// dependency execution considered as the parent.
	ParentHash github_com_mesg_foundation_engine_hash.Hash `` /* 132-byte string literal not displayed */
	// eventHash is unique event hash.
	EventHash github_com_mesg_foundation_engine_hash.Hash `` /* 130-byte string literal not displayed */
	// Status is the current status of execution.
	Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=mesg.types.Status" json:"status,omitempty" hash:"-"`
	// instanceHash is hash of the instance that can proceed an execution
	InstanceHash github_com_mesg_foundation_engine_hash.Hash `` /* 136-byte string literal not displayed */
	// taskKey is the key of the task of this execution.
	TaskKey string `protobuf:"bytes,6,opt,name=taskKey,proto3" json:"taskKey,omitempty" hash:"name:6"`
	// inputs data of the execution.
	Inputs *types.Struct `protobuf:"bytes,7,opt,name=inputs,proto3" json:"inputs,omitempty" hash:"name:7"`
	// outputs are the returned data of successful execution.
	Outputs *types.Struct `protobuf:"bytes,8,opt,name=outputs,proto3" json:"outputs,omitempty" hash:"-"`
	// error message of a failed execution.
	Error string `protobuf:"bytes,9,opt,name=error,proto3" json:"error,omitempty" hash:"-"`
	// tags are optionally associated with execution by the user.
	Tags []string `protobuf:"bytes,10,rep,name=tags,proto3" json:"tags,omitempty" hash:"name:10" validate:"dive,printascii"`
	// processHash is the unique hash of the process associated to this execution.
	ProcessHash github_com_mesg_foundation_engine_hash.Hash `` /* 136-byte string literal not displayed */
	// node key of the process.
	NodeKey string `protobuf:"bytes,12,opt,name=nodeKey,proto3" json:"nodeKey,omitempty" hash:"name:12"`
	// runner that should execute this execution.
	ExecutorHash github_com_mesg_foundation_engine_hash.Hash `` /* 138-byte string literal not displayed */
	// price of running the exeuction.
	Price string `protobuf:"bytes,14,opt,name=price,proto3" json:"price,omitempty" hash:"name:14" validate:"coins"`
	// blockHeight where the execution was included into blockchain.
	BlockHeight          int64    `protobuf:"varint,15,opt,name=blockHeight,proto3" json:"blockHeight,omitempty" hash:"-"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Execution represents a single execution run in engine.

func New added in v0.4.0

func New(processHash, instanceHash, parentHash, eventHash hash.Hash, nodeKey, taskKey, price string, inputs *types.Struct, tags []string, executorHash hash.Hash) *Execution

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

func (*Execution) Complete

func (execution *Execution) Complete(outputs *types.Struct) 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) Descriptor added in v0.14.0

func (*Execution) Descriptor() ([]byte, []int)

func (*Execution) Equal added in v0.14.0

func (this *Execution) Equal(that interface{}) bool

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.

func (*Execution) Failed added in v0.11.0

func (execution *Execution) Failed(err error) error

Failed changes execution status to failed and puts error information to execution. It returns an error if the status is different then InProgress.

func (*Execution) ProtoMessage added in v0.14.0

func (*Execution) ProtoMessage()

func (*Execution) Reset added in v0.14.0

func (m *Execution) Reset()

func (*Execution) String added in v0.14.0

func (m *Execution) String() string

func (*Execution) XXX_DiscardUnknown added in v0.14.0

func (m *Execution) XXX_DiscardUnknown()

func (*Execution) XXX_Marshal added in v0.14.0

func (m *Execution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Execution) XXX_Merge added in v0.14.0

func (m *Execution) XXX_Merge(src proto.Message)

func (*Execution) XXX_Size added in v0.14.0

func (m *Execution) XXX_Size() int

func (*Execution) XXX_Unmarshal added in v0.14.0

func (m *Execution) XXX_Unmarshal(b []byte) error

type Status added in v0.4.0

type Status int32

Status represents the status of a single execution. Note that a valid execution must have only one status flag at time.

const (
	// Unknown status represents any status unknown to execution.
	Status_Unknown Status = 0
	// Created is an initial status after execution creation.
	Status_Created Status = 1
	// InProgress informs that processing of execution has been started.
	Status_InProgress Status = 2
	// Completed is a success status after execution was processed.
	Status_Completed Status = 3
	// Failed is an error status after execution was processed.
	Status_Failed Status = 4
)

func (Status) EnumDescriptor added in v0.14.0

func (Status) EnumDescriptor() ([]byte, []int)

func (Status) String added in v0.11.0

func (x Status) String() string

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