Skip to content

Commit cd2461b

Browse files
committed
add change state batch
Signed-off-by: Fedor Partanskiy <[email protected]>
1 parent d5db3dc commit cd2461b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

peer/chaincode.proto

+6
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,9 @@ message ChaincodeData {
126126
// InstantiationPolicy for the chaincode
127127
common.SignaturePolicyEnvelope instantiation_policy = 8;
128128
}
129+
130+
// ChaincodeAdditionalParams - parameters passed to chaincode to notify about peer capabilities
131+
message ChaincodeAdditionalParams {
132+
bool use_write_batch = 1; // an indication that the peer can handle state write batches
133+
uint32 max_size_write_batch = 2; // maximum size of batches with write state
134+
}

peer/chaincode_shim.proto

+24
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ message ChaincodeMessage {
3838
PUT_STATE_METADATA = 21;
3939
GET_PRIVATE_DATA_HASH = 22;
4040
PURGE_PRIVATE_DATA = 23;
41+
WRITE_BATCH_STATE = 24;
4142
}
4243

4344
Type type = 1;
@@ -88,6 +89,29 @@ message PutStateMetadata {
8889
StateMetadata metadata = 4;
8990
}
9091

92+
// WriteBatchState - set of records for state changes sent by the batch
93+
message WriteBatchState {
94+
repeated WriteRecord rec = 1;
95+
}
96+
97+
// WriteRecord - single record with changes in the state of different types.
98+
// Filled in depending on the type.
99+
message WriteRecord {
100+
enum Type {
101+
UNDEFINED = 0;
102+
PUT_STATE = 9;
103+
DEL_STATE = 10;
104+
PUT_STATE_METADATA = 21;
105+
PURGE_PRIVATE_DATA = 23;
106+
}
107+
108+
string key = 1;
109+
bytes value = 2;
110+
string collection = 3;
111+
StateMetadata metadata = 4;
112+
Type type = 5;
113+
}
114+
91115
// DelState is the payload of a ChaincodeMessage. It contains a key which
92116
// needs to be recorded in the transaction's write set as a delete operation.
93117
// If the collection is specified, the key needs to be recorded in the

0 commit comments

Comments
 (0)