mesg-foundation/core

View on GitHub
protobuf/types/execution.proto

Summary

Maintainability
Test Coverage
syntax = "proto3";

import "gogo/protobuf/gogoproto/gogo.proto";
import "protobuf/types/struct.proto";

package mesg.types;
option go_package = "github.com/mesg-foundation/engine/execution";

option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = true;

// Status represents the status of a single execution.
// Note that a valid execution must have only one status
// flag at time.
enum Status {
  // Unknown status represents any status unknown to execution.
  Unknown = 0;

  // Proposed is the initial status of an execution.
  // More emitters must submit the same execution to reach consensus.
  Proposed = 1;

  // InProgress informs that the execution reach consensus and the processing of execution must start.
  InProgress = 2;

  // Completed is a success status after execution was processed and result submitted.
  Completed = 3;

  // Failed is an error status after execution was processed but an error occured.
  Failed = 4;
}

// Execution represents a single execution run in engine.
message Execution {
  // Hash is a unique hash to identify execution.
  bytes hash = 1 [
    (gogoproto.moretags) = 'hash:"-" validate:"required,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  // parentHash is the unique hash of parent execution.
  // if execution is triggered by another one,
  // dependency execution considered as the parent.
  bytes parentHash = 2 [
    (gogoproto.moretags) = 'hash:"name:2" validate:"required_without=EventHash,omitempty,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  // eventHash is unique event hash.
  bytes eventHash = 3 [
    (gogoproto.moretags) = 'hash:"name:3" validate:"required_without=ParentHash,omitempty,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  // Status is the current status of execution.
  Status status = 4 [
    (gogoproto.moretags) = 'hash:"-" validate:"required"'
  ];

  // instanceHash is hash of the instance that can proceed an execution
  bytes instanceHash = 5 [
    (gogoproto.moretags) = 'hash:"name:5" validate:"required,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  // taskKey is the key of the task of this execution.
  string taskKey = 6 [
    (gogoproto.moretags) = 'hash:"name:6" validate:"required,printascii"'
  ];

  // inputs data of the execution.
  mesg.protobuf.Struct inputs = 7 [
    (gogoproto.moretags) = 'hash:"name:7"'
  ];

  // outputs are the returned data of successful execution.
  mesg.protobuf.Struct outputs = 8 [
    (gogoproto.moretags) = 'hash:"-"'
  ];

  // error message of a failed execution.
  string error = 9 [
    (gogoproto.moretags) = 'hash:"-"'
  ];

  // tags are optionally associated with execution by the user.
  repeated string tags = 10 [
    (gogoproto.moretags) = 'hash:"name:10" validate:"dive,printascii"'
  ];

  // processHash is the unique hash of the process associated to this execution.
  bytes processHash = 11 [
    (gogoproto.moretags) = 'hash:"name:11" validate:"omitempty,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  // node key of the process.
  string nodeKey = 12 [
    (gogoproto.moretags) = 'hash:"name:12"'
  ];

  // runner that should execute this execution.
  bytes executorHash = 13 [
    (gogoproto.moretags) = 'hash:"name:13" validate:"required,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  // price of running the execution.
  string price = 14 [
    (gogoproto.moretags) = 'hash:"-" validate:"omitempty,bigint"'
  ];

  // blockHeight where the execution was included into blockchain.
  int64 blockHeight = 15 [
    (gogoproto.moretags) = 'hash:"-"'
  ];

  // Emitter is a runner that proposed an execution.
  message Emitter {
    // Emitter's hash.
    bytes runnerHash = 1 [
      (gogoproto.moretags) = 'hash:"-" validate:"required,hash"',
      (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
    ];

    // Block height when this emitter proposed the execution.
    int64 blockHeight = 2 [
      (gogoproto.moretags) = 'hash:"-" validate:"required"'
    ];
  }
    
  // list of emitters of this execution.
  repeated Emitter emitters = 16 [
    (gogoproto.moretags) = 'hash:"-" validate:"dive"'
  ];

  // The address of the execution.
  bytes address = 17 [
    (gogoproto.moretags) = 'hash:"-" validate:"required,accaddress"',
    (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"
  ];

  // Start time in nanoseconds.
  int64 start = 18 [
    (gogoproto.moretags) = 'hash:"-" validate:""'
  ];
  
  // Stop time in nanoseconds.
  int64 stop = 19 [
    (gogoproto.moretags) = 'hash:"-" validate:""'
  ];
}