-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Indexer-Grpc-V2] Add protos. #15701
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
syntax = "proto3"; | ||
|
||
package aptos.indexer.v1; | ||
|
||
import "aptos/indexer/v1/raw_data.proto"; | ||
import "aptos/transaction/v1/transaction.proto"; | ||
import "aptos/util/timestamp/timestamp.proto"; | ||
|
||
message StreamProgressSampleProto { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i feel Proto here is a little redundant; either remove or use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I use here because in the rust code I have a corresponding struct called |
||
optional aptos.util.timestamp.Timestamp timestamp = 1; | ||
uint64 version = 2; | ||
uint64 size_bytes = 3; | ||
} | ||
|
||
message StreamProgress { | ||
repeated StreamProgressSampleProto samples = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the intent behind collecting multiple samples here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. calculate tps, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sync'ed offline; for monitoring purpose. |
||
} | ||
|
||
message ActiveStream { | ||
optional string id = 1; | ||
optional aptos.util.timestamp.Timestamp start_time = 2; | ||
uint64 start_version = 3; | ||
optional uint64 end_version = 4; | ||
|
||
optional StreamProgress progress = 5; | ||
} | ||
|
||
message StreamInfo { | ||
repeated ActiveStream active_streams = 1; | ||
} | ||
|
||
message LiveDataServiceInfo { | ||
optional uint64 chain_id = 1; | ||
optional aptos.util.timestamp.Timestamp timestamp = 2; | ||
optional uint64 known_latest_version = 3; | ||
optional StreamInfo stream_info = 4; | ||
// If not present, it means the data service is not available to serve anything yet. | ||
optional uint64 min_servable_version = 5; | ||
} | ||
|
||
message HistoricalDataServiceInfo { | ||
optional uint64 chain_id = 1; | ||
optional aptos.util.timestamp.Timestamp timestamp = 2; | ||
optional uint64 known_latest_version = 3; | ||
optional StreamInfo stream_info = 4; | ||
} | ||
|
||
message FullnodeInfo { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think we should include validation here? like chain id? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Done. |
||
optional uint64 chain_id = 1; | ||
optional aptos.util.timestamp.Timestamp timestamp = 2; | ||
optional uint64 known_latest_version = 3; | ||
} | ||
|
||
message GrpcManagerInfo { | ||
optional uint64 chain_id = 1; | ||
optional aptos.util.timestamp.Timestamp timestamp = 2; | ||
optional uint64 known_latest_version = 3; | ||
optional string master_address = 4; | ||
} | ||
|
||
message ServiceInfo { | ||
optional string address = 1; | ||
oneof info { | ||
LiveDataServiceInfo live_data_service_info = 2; | ||
HistoricalDataServiceInfo historical_data_service_info = 3; | ||
FullnodeInfo fullnode_info = 4; | ||
GrpcManagerInfo grpc_manager_info = 5; | ||
} | ||
} | ||
|
||
message HeartbeatRequest { | ||
optional ServiceInfo service_info = 1; | ||
} | ||
|
||
message HeartbeatResponse { | ||
optional uint64 known_latest_version = 1; | ||
} | ||
|
||
message PingDataServiceRequest { | ||
optional uint64 known_latest_version = 1; | ||
// `true` for live data service, `false` for historical data service. | ||
bool ping_live_data_service = 2; | ||
} | ||
|
||
message PingDataServiceResponse { | ||
oneof info { | ||
LiveDataServiceInfo live_data_service_info = 1; | ||
HistoricalDataServiceInfo historical_data_service_info = 2; | ||
} | ||
} | ||
|
||
message GetDataServiceForRequestRequest { | ||
optional GetTransactionsRequest user_request = 1; | ||
} | ||
|
||
message GetDataServiceForRequestResponse { | ||
string data_service_address = 1; | ||
} | ||
|
||
service GrpcManager { | ||
rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse); | ||
rpc GetTransactions(GetTransactionsRequest) returns (TransactionsResponse); | ||
rpc GetDataServiceForRequest(GetDataServiceForRequestRequest) returns (GetDataServiceForRequestResponse); | ||
} | ||
|
||
service DataService { | ||
rpc Ping(PingDataServiceRequest) returns (PingDataServiceResponse); | ||
rpc GetTransactions(GetTransactionsRequest) returns (stream TransactionsResponse); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
unimplemented!()
will cause a panic at runtime. Consider returning a proper gRPC response instead:This maintains the gRPC contract while indicating the endpoint is not yet implemented.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.