• senthil's avatar
    FAB-11455 peer side changes to support pagination · 0ee45ac4
    senthil authored
    We need to make necessary changes in the core/chaincode/handler.go for
    pagination of results. Currently, the handler.go in the peer calls the ledger
    to execute queries (range query, rich query) on behalf of the chaincode.
    On an execution of a query, the ledger returns an iterator. Using the
    iterator, peer constructs the query response with records and send the
    response to chaincode.
    This CR makes the following changes to support pagination of results.
    When a pagination of results is enabled for a query (i.e., when the query
    metadata is passed with either pageSize or a bookmark or both for range/rich
    queries), the peer would call the new pagination enabled range/rich query
    APIs at ledger which would return a response metadata in addition to an
    iterator. The response metadata would contain the next bookmark and the
    number of records fetched for the query. Peer retrieves all fetched records
    from ledger, constructs a query response including both records and
    response metadata. The chaincode can pass on the bookmark in the response
    metadata to the application/sdk.
    Change-Id: Id770dd184369d1f7eaa30f046e1923c8fde564a5
    Signed-off-by: default avatarsenthil <cendhu@gmail.com>
    Signed-off-by: default avatarChris Elder <chris.elder@us.ibm.com>