add hash query
Summary: add TransactionCount/GetTransactions 增加关于 transaction/block 相关的查询接口 Test Plan: none Reviewers: nex, wuyi Reviewed By: nex Differential Revision: https://phabricator.internetapi.cn/D25
This commit is contained in:
89
bdledger/api/query_service.proto
Normal file
89
bdledger/api/query_service.proto
Normal file
@@ -0,0 +1,89 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package bdledger.api.txledger;
|
||||
|
||||
import "bdledger/api/common.proto";
|
||||
|
||||
option go_package = "bdware.org/bdledger/sdk/api/grpc/txledger";
|
||||
option java_package = "bdledger.api.grpc.txledger";
|
||||
option java_outer_classname = "TransactionLedgerProto";
|
||||
option java_multiple_files = true;
|
||||
|
||||
service Query {
|
||||
rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse);
|
||||
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
|
||||
rpc GetTransactions(TransactionsRequest) returns (GetTransactionsResponse);
|
||||
rpc CountTransactions(TransactionsRequest) returns (CountTransactionsResponse);
|
||||
rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse);
|
||||
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (GetTransactionByHashResponse);
|
||||
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (GetTransactionByBlockHashAndIndexResponse);
|
||||
}
|
||||
|
||||
// repeated Transaction/BlockFilters are combined by "&&"(and) operator;
|
||||
message TransactionFilter {
|
||||
bytes hash = 1;
|
||||
bytes from = 2;
|
||||
bytes to = 3;
|
||||
bytes timestamp = 4;
|
||||
}
|
||||
|
||||
message BlockFilter {
|
||||
bytes hash = 1;
|
||||
int64 timestamp = 2;
|
||||
}
|
||||
|
||||
message BlocksRequest {
|
||||
string ledger = 1;
|
||||
repeated BlockFilter filters = 2;
|
||||
required int64 start_timestamp = 3;
|
||||
int64 end_timestamp = 4;
|
||||
}
|
||||
message GetBlocksResponse {
|
||||
repeated common.Block blocks= 1;
|
||||
int64 start_timestamp = 2;
|
||||
int64 end_timestamp = 3;
|
||||
}
|
||||
message CountBlocksResponse {
|
||||
uint64 count = 1;
|
||||
}
|
||||
|
||||
message TransactionsRequest {
|
||||
string ledger = 1;
|
||||
repeated TransactionFilter filters = 2;
|
||||
required int64 start_timestamp = 3;
|
||||
int64 end_timestamp = 4;
|
||||
}
|
||||
message GetTransactionsResponse {
|
||||
repeated common.Transaction Transactions = 1;
|
||||
int64 start_timestamp = 2;
|
||||
int64 end_timestamp = 3;
|
||||
}
|
||||
message CountTransactionsResponse {
|
||||
uint64 count = 1;
|
||||
}
|
||||
|
||||
message GetBlockByHashRequest {
|
||||
string ledger = 1;
|
||||
bytes hash = 2;
|
||||
bool full_transaction = 3;
|
||||
}
|
||||
message GetBlockByHashResponse {
|
||||
common.Block block = 1;
|
||||
}
|
||||
|
||||
message GetTransactionByHashRequest {
|
||||
string ledger = 1;
|
||||
bytes hash = 2;
|
||||
}
|
||||
message GetTransactionByHashResponse {
|
||||
common.Transaction transaction = 1;
|
||||
}
|
||||
|
||||
message GetTransactionByBlockHashAndIndexRequest {
|
||||
string ledger = 1;
|
||||
bytes block_hash = 2;
|
||||
uint32 index = 3;
|
||||
}
|
||||
message GetTransactionByBlockHashAndIndexResponse {
|
||||
common.Transaction transaction = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user