Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collector service to grpc #41

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion proto/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 27 additions & 0 deletions proto/collector/collector.proto
Original file line number Diff line number Diff line change
@@ -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;
}
56 changes: 56 additions & 0 deletions proto/collector/service.proto
Original file line number Diff line number Diff line change
@@ -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;
}