hyperledger / hyperledger/fabric-chaincode-java

Read/write batching

Offen
#378 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement help wanted
Vorherrschende Sprache
Java
Sterne
323
Forks
210
Ø Merge
8 Std. 1 Min.
Gemergte PRs (30 T.)
8

Beschreibung

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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.