diff --git a/proto/Makefile b/proto/Makefile index 99db07364..b7f785b01 100644 --- a/proto/Makefile +++ b/proto/Makefile @@ -1,4 +1,7 @@ -build: build-exposer build-registry +build: build-collector build-exposer build-registry + +build-collector: + buf generate --path collector/ --output ../collector build-registry: buf generate --path registry/ --output ../registry diff --git a/proto/collector/collector.proto b/proto/collector/collector.proto new file mode 100644 index 000000000..705270e93 --- /dev/null +++ b/proto/collector/collector.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package collector; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/Anmol1696/starship/collector"; + +message Chain { + string name = 1; + string type = 2; + repeated Validator validator = 3; +} + +message Validator { + string name = 1; + string moniker = 2; + string address = 3; +} + +message State { + string id = 1; + string height = 2; + string data_type = 3; +} diff --git a/proto/collector/service.proto b/proto/collector/service.proto new file mode 100644 index 000000000..0e2b6cf47 --- /dev/null +++ b/proto/collector/service.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; +package collector; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/Anmol1696/starship/collector"; + +// Interface for service +service Collector { + // GetNodeID will returns current node id + rpc GetChains(google.protobuf.Empty) returns (ResponseNodeID) { + option (google.api.http) = { get: "/node_id" }; + } + // All Exports + rpc ListChainExports(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { get: "/chains/{chain}/validators/{validator}/exports" }; + } + rpc GetChainExport(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { get: "/chains/{chain}/validators/{validator}/exports/{id}" }; + } + rpc SetChainExport(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/chains/{chain}/validators/{validator}/exports/{id}" + body: "" + }; + } + // All snapshots + rpc ListChainSnapshots(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { get: "/chains/{chain}/validators/{validator}/snapshots" }; + } + rpc GetChainSnapshots(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { get: "/chains/{chain}/validators/{validator}/snapshots/{id}" }; + } + rpc SetChainSnapshots(google.protobuf.Empty) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/chains/{chain}/validators/{validator}/snapshots/{id}" + body: "" + }; + } +} + +message ResponseNodeID { + string node_id = 1; +} + +message ResponsePubKey { + string type = 1; + string key = 2; +} + +message ResponseFileData { + google.protobuf.Any data = 1; +}