bdledger-apis/bdledger/api/query.proto

94 lines
2.4 KiB
Protocol Buffer
Raw Normal View History

syntax = "proto3";
package bdledger.api;
import "bdledger/api/common.proto";
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
option java_package = "bdledger.api.grpc.query";
option java_outer_classname = "QueryProto";
option java_multiple_files = true;
service Query {
2020-03-07 05:15:29 +00:00
rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse);
2020-03-09 16:10:34 +00:00
rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse); // start_timestamp is required
2020-03-07 05:15:29 +00:00
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (GetTransactionByHashResponse);
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (GetTransactionByBlockHashAndIndexResponse);
rpc GetTransactions (TransactionsRequest) returns (GetTransactionsResponse);
rpc CountTransactions (TransactionsRequest) returns (CountTransactionsResponse);
}
message BlockFilter {
2020-03-07 05:15:29 +00:00
bytes hash = 1;
int64 timestamp = 2;
}
// repeated Transaction/BlockFilters are combined by "&&"(and) operator;
message TransactionFilter {
2020-03-07 05:15:29 +00:00
bytes hash = 1;
bytes from = 2;
bytes to = 3;
bytes timestamp = 4;
}
message GetBlockByHashRequest {
2020-03-07 05:15:29 +00:00
string ledger = 1;
bytes hash = 2;
bool full_transactions = 3;
}
message GetBlockByHashResponse {
2020-03-07 05:15:29 +00:00
Block block = 1;
}
message BlocksRequest {
2020-03-07 05:15:29 +00:00
string ledger = 1;
2020-03-09 16:10:34 +00:00
int64 start_timestamp = 2;
int64 end_timestamp = 3;
repeated BlockFilter filters = 4;
}
message GetBlocksResponse {
2020-03-07 05:15:29 +00:00
repeated Block blocks = 1;
int64 start_timestamp = 2;
int64 end_timestamp = 3;
}
message CountBlocksResponse {
2020-03-07 05:15:29 +00:00
uint64 count = 1;
2020-04-02 09:23:36 +00:00
int64 start_timestamp = 2;
int64 end_timestamp = 3;
}
message GetTransactionByHashRequest {
2020-03-07 05:15:29 +00:00
string ledger = 1;
bytes hash = 2;
}
message GetTransactionByHashResponse {
2020-03-07 05:15:29 +00:00
Transaction transaction = 1;
}
message GetTransactionByBlockHashAndIndexRequest {
2020-03-07 05:15:29 +00:00
string ledger = 1;
bytes block_hash = 2;
uint32 index = 3;
}
message GetTransactionByBlockHashAndIndexResponse {
2020-03-07 05:15:29 +00:00
Transaction transaction = 1;
}
message TransactionsRequest {
2020-03-07 05:15:29 +00:00
string ledger = 1;
int64 start_timestamp = 2; // required
int64 end_timestamp = 3;
repeated TransactionFilter filters = 4;
}
message GetTransactionsResponse {
2020-03-07 05:15:29 +00:00
repeated Transaction transactions = 1;
int64 start_timestamp = 2;
int64 end_timestamp = 3;
}
message CountTransactionsResponse {
2020-03-07 05:15:29 +00:00
uint64 count = 1;
2020-04-02 09:23:36 +00:00
int64 start_timestamp = 2;
int64 end_timestamp = 3;
}