Description
Description
Query API supports lazy pagination. Currently it is not documented in the reference (https://hyperledger.github.io/iroha-2-docs/api/torii-endpoints.html#query). I propose to document it.
How it works
Originally posted by @Arjentix: #397 (comment)
So basically after hyperledger-iroha/iroha#3958 users should send either SignedQuery
with Pagination
and Sorting
or just ForwardCursor
.
SignedQuery
-- an Iroha query signed by a user keypair
Pagination
-- struct with two numbers: limit of indexing and start of indexing. If both are zeros, then pagination is not applied
Sorting
-- currently we support sorting only by a metadata key of an asset metadata. So that user can place Name
(string with some contrains on its content) inside and then all output assets will be sorted by a value of the specified key if there is some. Sorting
can contain nothing as well, in that case it won't be applied.
ForwardCursor
-- at first you don't have it. But if the output of your query is a big array, then you'll get a cursor from Iroha with a part of the answer. To get the other parts you should provide this cursor to Iroha in a new request. Repeat this step until cursor is depleted (you'll know that by getting empty cursor or error).