docs: update query APIs' docs

This commit is contained in:
Nex 2021-01-19 16:20:35 +08:00
parent 497aeb1216
commit 486291351a

View File

@ -17,17 +17,31 @@ service Query {
/**
* Get blocks in a timestamp range
*
* start_timestamp is required
* Requirement: start_timestamp <= end_timestamp
* If neither 'start_timestamp' nor 'end_timestamp' is specified, then 'start_timestamp' will be set to
* the genesis block's timestamp, and 'end_timestamp' will be set to (start_timestamp + query.maxDuration)
* (query.maxDuration is specified in go-bdledger's config file).
* If only 'end_timestamp' is not specified, or (end_timestamp - start_timestamp > query.maxDuration),
* then 'end_timestamp' will be set to (start_timestamp + query.maxDuration).
* If only 'start_timestamp' is not specified, then 'start_timestamp' will be set to (end_timestamp - query.maxDuration).
* In all cases, 'start_timestamp' will never be earlier than the genesis block's timestamp,
* and 'end_timestamp' will never be later than the current timestamp when the node process the query request.
*/
rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse);
/**
* Count all blocks in a ledger, or blocks in a timestamp range
*
* Requirement: start_timestamp <= end_timestamp
* If neither 'start_timestamp' nor 'end_timestamp' is specified, then count all blocks in the specified ledger.
* If only 'end_timestamp' is not specified, then count all blocks with timestamps later than 'start_timestamp'.
* If only 'start_timestamp' is not specified, then count all blocks with timestamps earlier than 'end_timestamp'.
* In all cases, 'start_timestamp' will never be earlier than the genesis block's timestamp,
* and 'end_timestamp' will never be later than the current timestamp when the node process the query request.
*/
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
/**
* Get recent 'count' blocks (Only support IncludeTransactions=NONE for now)
* n个区块
* 'count'
*/
rpc GetRecentBlocks (RecentBlocksRequest) returns (GetBlocksResponse);
/**
@ -43,12 +57,13 @@ service Query {
/**
* Get transactions in a timestamp range
*
* 'start_timestamp' and 'end_timestamp' follow the same requirements and rules as in 'GetBlocks'.
*/
rpc GetTransactions (TransactionsRequest) returns (GetTransactionsResponse);
/**
* Count all transactions in a ledger, or transactions in a timestamp range
*
* start_timestamp is required
* 'start_timestamp' and 'end_timestamp' follow the same requirements and rules as in 'CountBlocks'.
*/
rpc CountTransactions (TransactionsRequest) returns (CountTransactionsResponse);
}