hyperledger / hyperledger/fabric-chaincode-java
Read/write batching
- Ngôn ngữ chính
- Java
- Star
- 323
- Fork
- 210
- Merge trung bình
- 8 giờ 1 phút
- Pull request đã merge (30 ngày)
- 8
Mô tả
Fabric [v3.1.0](https://github.com/hyperledger/fabric/releases/tag/v3.1.0) introduced a new performance optimization that allows ledger reads and writes to be performed in batches. This feature is described in the [Peer to Chaincode Communication Optimization RFC](https://github.com/hyperledger/fabric-rfcs/blob/main/text/0011-peer-chaincode-optimization.md).
[fabric-chaincode-go](https://github.com/hyperledger/fabric-chaincode-go) provides a reference implementation of this functionality, which should be replicated by the Java chaincode libraries.
Implementation is composed of these component parts:
- [Configuration of batching based on peer capabilities when a connection is established](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/handler.go#L807-L819)
- Modifications to [PutState](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/stub.go#L203-L221) (and [PutPrivateData](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/stub.go#L288-L295)) API functions
- An accompanying [WriteBatch](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/batch.go) implementation to collect batched writes.
- Modification of [handleInit](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/handler.go#L200-L202) and [handleTransaction](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/handler.go#L230-L232) to ensure that batched writes are sent at the end of a client invocation
- New Stub API functions:
- [StartWriteBatch](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/stub.go#L652-L657)
- [FinishWriteBatch](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/stub.go#L659-L664)
- [GetMultipleStates](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/stub.go#L169-L174)
- [GetMultiplePrivateData](https://github.com/hyperledger/fabric-chaincode-go/blob/9e139c0c2edd362fbfe24261de66fff60eccc6d0/shim/stub.go#L272-L278)
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.