Skip to content

Document how lazy pagination works #426

Open
@0x009922

Description

@0x009922

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-conceptsCore Iroha concepts (data model, operations, mechanics)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions