mesg-foundation/core

View on GitHub
protobuf/types/ownership.proto

Summary

Maintainability
Test Coverage
syntax = "proto3";

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

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

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


// Ownership is a ownership relation between one owner and a resource.
message Ownership {

  // Service's hash.
  bytes hash = 1 [
    (gogoproto.moretags) = 'hash:"-" validate:"required,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  // The owner of the resource.
  // TODO: to transform to accAddress
  string owner = 2 [
    (gogoproto.moretags) = 'hash:"name:2" validate:"required"'
  ];

  // Resource's hash.
  bytes resourceHash = 3 [
    (gogoproto.moretags) = 'hash:"name:3" validate:"required,hash"',
    (gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
  ];

  enum Resource {
    None = 0;
    Service = 1;
    Process = 2;
    Runner = 3;
  }

  // Resource's type.
  Resource resource = 4 [
    (gogoproto.moretags) = 'validate:"required"'
  ];

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