Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #126 from mesg-foundation/feature/update-proto
Browse files Browse the repository at this point in the history
Update core api to latest version
  • Loading branch information
antho1404 authored Sep 4, 2019
2 parents 34d6654 + 9f079d1 commit 1ee0ae3
Show file tree
Hide file tree
Showing 13 changed files with 365 additions and 115 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mesg-js",
"version": "4.3.0-beta.2",
"version": "4.3.0-beta.3",
"description": "",
"main": "lib/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/protobuf/api/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ message InfoRequest {}
message InfoReply {
message CoreService {
string sid = 1; // sid of the service
string hash = 2; // hash of the service
bytes hash = 2; // hash of the service
string url = 3; // url used to deploy the service
string key = 4; // key to identify the core service
}
Expand Down
21 changes: 17 additions & 4 deletions src/protobuf/api/event.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";

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

package api;
Expand All @@ -24,10 +25,16 @@ message StreamEventRequest {
// Filter contains filtering criteria.
message Filter {
// hash to filter events.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// instance's hash to filter events.
bytes instanceHash = 2;
bytes instanceHash = 2 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// key is the key of the event.
string key = 3;
Expand All @@ -40,7 +47,10 @@ message StreamEventRequest {
// CreateEventRequest defines request for execution update.
message CreateEventRequest {
// instanceHash is hash of instance that can proceed an execution.
bytes instanceHash = 1;
bytes instanceHash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// key is the key of the event.
string key = 2;
Expand All @@ -52,5 +62,8 @@ message CreateEventRequest {
// CreateEventResponse defines response for execution update.
message CreateEventResponse {
// Hash represents event.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}
26 changes: 21 additions & 5 deletions src/protobuf/api/execution.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";

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

package api;
Expand Down Expand Up @@ -28,7 +29,10 @@ service Execution {

// CreateExecutionRequest defines request to create a single execution.
message CreateExecutionRequest {
bytes instanceHash = 1;
bytes instanceHash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
string taskKey = 2;
google.protobuf.Struct inputs = 3;
repeated string tags = 4;
Expand All @@ -37,13 +41,19 @@ message CreateExecutionRequest {
// CreateExecutionResponse defines response for execution creation.
message CreateExecutionResponse {
// Execution's hash.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// GetExecutionRequest defines request to retrieve a single execution.
message GetExecutionRequest {
// Execution's hash to fetch.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// StreamExecutionRequest defines request to retrieve a stream of executions.
Expand All @@ -54,7 +64,10 @@ message StreamExecutionRequest{
repeated types.Status statuses = 1;

// Instance's hash to filter executions.
bytes instanceHash = 2;
bytes instanceHash = 2 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// taskKey to filter executions.
string taskKey = 3;
Expand All @@ -70,7 +83,10 @@ message StreamExecutionRequest{
// UpdateExecutionRequest defines request for execution update.
message UpdateExecutionRequest {
// Hash represents execution.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// result pass to execution
oneof result {
Expand Down
26 changes: 21 additions & 5 deletions src/protobuf/api/instance.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";

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

package api;

Expand All @@ -27,13 +28,19 @@ service Instance {

// The request's data for the `Get` API.
message GetInstanceRequest {
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The request's data for the `List` API.
message ListInstancesRequest {
// Filter by Services' hash.
bytes serviceHash = 1;
bytes serviceHash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The response's data for the `List` API.
Expand All @@ -45,7 +52,10 @@ message ListInstancesResponse {
// The request's data for the `Create` API.
message CreateInstanceRequest {
// Service's hash.
bytes serviceHash = 1;
bytes serviceHash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// Environmental variables to apply to the Instance.
repeated string env = 2;
Expand All @@ -54,13 +64,19 @@ message CreateInstanceRequest {
// The response's data for the `Create` API.
message CreateInstanceResponse {
// The instance's hash created.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The request's data for the `Delete` API.
message DeleteInstanceRequest {
// Instance's hash
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// If true, any persistent data (volumes) that belongs to the instance and its dependencies will also be deleted.
bool deleteData = 2;
Expand Down
16 changes: 13 additions & 3 deletions src/protobuf/api/process.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
syntax = "proto3";

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

package api;
Expand Down Expand Up @@ -36,13 +37,19 @@ message CreateProcessRequest {
// The response's data for the `Create` API.
message CreateProcessResponse {
// The process's hash created.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The request's data for the `Delete` API.
message DeleteProcessRequest {
// The process's hash to delete.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The response's data for the `Delete` API, doesn't contain anything.
Expand All @@ -52,7 +59,10 @@ message DeleteProcessResponse {
// The request's data for the `Get` API.
message GetProcessRequest {
// The process's hash to fetch.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The request's data for the `List` API.
Expand Down
20 changes: 16 additions & 4 deletions src/protobuf/api/service.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";

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

package api;

Expand Down Expand Up @@ -38,7 +39,9 @@ message CreateServiceRequest {
string description = 3;

// Configurations related to the service
types.Service.Configuration configuration = 4;
types.Service.Configuration configuration = 4 [
(gogoproto.nullable) = false
];

// The list of tasks this service can execute.
repeated types.Service.Task tasks = 5;
Expand All @@ -59,13 +62,19 @@ message CreateServiceRequest {
// The response's data for the `Create` API.
message CreateServiceResponse {
// The service's hash created.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The request's data for the `Delete` API.
message DeleteServiceRequest {
// The service's hash to delete.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The response's data for the `Delete` API, doesn't contain anything.
Expand All @@ -75,7 +84,10 @@ message DeleteServiceResponse {
// The request's data for the `Get` API.
message GetServiceRequest {
// The service's hash to fetch.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];
}

// The request's data for the `List` API.
Expand Down
25 changes: 20 additions & 5 deletions src/protobuf/types/event.proto
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
syntax = "proto3";

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

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

option (gogoproto.goproto_getters_all) = false;

// Event represents a single event run in engine.
message Event {
// Hash is a unique hash to identify event.
bytes hash = 1;
bytes hash = 1 [
(gogoproto.moretags) = 'hash:"-"',
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// instanceHash is hash of instance that can proceed an execution.
bytes instanceHash = 2;
bytes instanceHash = 2 [
(gogoproto.moretags) = 'hash:"name:2"',
(gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash",
(gogoproto.nullable) = false
];

// key is the key of the event.
string key = 3;
string key = 3 [
(gogoproto.moretags) = 'hash:"name:3"'
];

// data is the data for the event.
google.protobuf.Struct data = 4;
google.protobuf.Struct data = 4 [
(gogoproto.moretags) = 'hash:"name:4"'
];
}
Loading

0 comments on commit 1ee0ae3

Please sign in to comment.