execution

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Status_name = map[int32]string{
	0: "Unknown",
	1: "Proposed",
	2: "InProgress",
	3: "Completed",
	4: "Failed",
}
View Source
var Status_value = map[string]int32{
	"Unknown":    0,
	"Proposed":   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 `` /* 148-byte string literal not displayed */
	// 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 `` /* 193-byte string literal not displayed */
	// eventHash is unique event hash.
	EventHash github_com_mesg_foundation_engine_hash.Hash `` /* 192-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:"-" validate:"required"`
	// instanceHash is hash of the instance that can proceed an execution
	InstanceHash github_com_mesg_foundation_engine_hash.Hash `` /* 169-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" validate:"required,printascii"`
	// 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 `` /* 170-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 `` /* 171-byte string literal not displayed */
	// price of running the execution.
	Price string `protobuf:"bytes,14,opt,name=price,proto3" json:"price,omitempty" hash:"-" validate:"omitempty,bigint"`
	// blockHeight where the execution was included into blockchain.
	BlockHeight int64 `protobuf:"varint,15,opt,name=blockHeight,proto3" json:"blockHeight,omitempty" hash:"-"`
	// list of emitters of this execution.
	Emitters []*Execution_Emitter `protobuf:"bytes,16,rep,name=emitters,proto3" json:"emitters,omitempty" hash:"-" validate:"dive"`
	// The address of the execution.
	Address github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 163-byte string literal not displayed */
	// Start time in nanoseconds.
	Start int64 `protobuf:"varint,18,opt,name=start,proto3" json:"start,omitempty" hash:"-" validate:""`
	// Stop time in nanoseconds.
	Stop                 int64    `protobuf:"varint,19,opt,name=stop,proto3" json:"stop,omitempty" hash:"-" validate:""`
	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 string, inputs *types.Struct, tags []string, executorHash hash.Hash) (*Execution, error)

New returns a new execution.

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 than 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. It returns an error if the status is different than Proposed.

func (*Execution) Fail added in v0.20.0

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

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

func (*Execution) GetDuration added in v0.26.0

func (execution *Execution) GetDuration() int64

GetDuration returns the duration of the execution in seconds

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 Execution_Emitter added in v0.20.0

type Execution_Emitter struct {
	// Emitter's hash.
	RunnerHash github_com_mesg_foundation_engine_hash.Hash `` /* 160-byte string literal not displayed */
	// Block height when this emitter proposed the execution.
	BlockHeight          int64    `protobuf:"varint,2,opt,name=blockHeight,proto3" json:"blockHeight,omitempty" hash:"-" validate:"required"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Emitter is a runner that proposed an execution.

func (*Execution_Emitter) Descriptor added in v0.20.0

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

func (*Execution_Emitter) Equal added in v0.20.0

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

func (*Execution_Emitter) ProtoMessage added in v0.20.0

func (*Execution_Emitter) ProtoMessage()

func (*Execution_Emitter) Reset added in v0.20.0

func (m *Execution_Emitter) Reset()

func (*Execution_Emitter) String added in v0.20.0

func (m *Execution_Emitter) String() string

func (*Execution_Emitter) XXX_DiscardUnknown added in v0.20.0

func (m *Execution_Emitter) XXX_DiscardUnknown()

func (*Execution_Emitter) XXX_Marshal added in v0.20.0

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

func (*Execution_Emitter) XXX_Merge added in v0.20.0

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

func (*Execution_Emitter) XXX_Size added in v0.20.0

func (m *Execution_Emitter) XXX_Size() int

func (*Execution_Emitter) XXX_Unmarshal added in v0.20.0

func (m *Execution_Emitter) 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
	// Proposed is the initial status of an execution.
	// More emitters must submit the same execution to reach consensus.
	Status_Proposed Status = 1
	// InProgress informs that the execution reach consensus and the processing of execution must start.
	Status_InProgress Status = 2
	// Completed is a success status after execution was processed and result submitted.
	Status_Completed Status = 3
	// Failed is an error status after execution was processed but an error occured.
	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