-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAB-2055 GetHistoryForKey() returns timestamp
Updated Ledger's GetHistoryForKey() API to return key, value, timestamp and delete marker. Further, query response from ledger is directly forwarded to shim layer to cast the response appropriately and return to chaincode as a struct. We have made the following changes to realize this. (i) Renamed QueryStateResponse proto message to QueryResponse. The QueryResult from ledger is converted to a 2D byte array (encoding using gob) and appropriately set in QueryResponse struct. Hence, the QueryResponse is consistent across different query types. This approach reduces the repetition of code in peer's handler.go that process the QueryResult from ledger. (iii) Introduced two types of iterator in chaincode shim: One for iterating over QueryResult of range/execute query and another for iterating over QueryResult of history query. Now, these iterator processes QueryResult (i.e., 2D byte array, decoded using gob) and returns a struct to chaincode: - ledger.KV struct for range and execute query, - ledger.KeyModification struct for history query. As a result, chaincode examples (map.go, marbles_chaincode.go) and mockstub have been modified (iv) Added test for historyQueries (from shim layer) (v) As java shim is significnatly behind go shim, I have commented out range query functionality for now. As a separate changeset, need to update java shim's range query with updated chaincode proto and add other query functionalities. Change-Id: I5e0cfd5f712f686361f8610d69db57646ad52b4f Signed-off-by: senthil <cendhu@gmail.com>
- Loading branch information
Showing
22 changed files
with
530 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.