Skip to content

Commit 805cf94

Browse files
cendhuChris Elder
authored andcommitted
FAB-11307 define new chaincode APIs for pagination
For pagination, chaincode needs to pass a page size and a bookmark when performing a range/rich query. As changing existing range/rich query would break the backward compatibility of existing chaincodes/prod-system, this CR introduces the following chaincode APIs. (1) GetStateByRangeWithPagination(startKey, endKey, pageSize, bookmark) (2) GetQueryResultWithPagination(query, pageSize, bookmark) (3) GetStateByPartialCompositeKeyWithPagination(objectType, keys, pageSize, bookmark) Change-Id: Ia1751f5a34b54a498eb8ff4caa7cc5269df47903 Signed-off-by: senthil <cendhu@gmail.com> Signed-off-by: Chris Elder <chris.elder@us.ibm.com>
1 parent 666b8c2 commit 805cf94

File tree

6 files changed

+577
-6
lines changed

6 files changed

+577
-6
lines changed

core/chaincode/lifecycle/mock/chaincode_stub.go

Lines changed: 234 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/chaincode/shim/chaincode.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,21 @@ func (stub *ChaincodeStub) GetStateByPartialCompositeKey(objectType string, attr
723723
}
724724
}
725725

726+
func (stub *ChaincodeStub) GetStateByRangeWithPagination(startKey, endKey string, pageSize int32,
727+
bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error) {
728+
return nil, nil, nil
729+
}
730+
731+
func (stub *ChaincodeStub) GetStateByPartialCompositeKeyWithPagination(objectType string, keys []string,
732+
pageSize int32, bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error) {
733+
return nil, nil, nil
734+
}
735+
736+
func (stub *ChaincodeStub) GetQueryResultWithPagination(query string, pageSize int32,
737+
bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error) {
738+
return nil, nil, nil
739+
}
740+
726741
func (iter *StateQueryIterator) Next() (*queryresult.KV, error) {
727742
if result, err := iter.nextResult(STATE_QUERY_RESULT); err == nil {
728743
return result.(*queryresult.KV), err

0 commit comments

Comments
 (0)