Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add write batch to state #243

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions peer/chaincode.proto
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,9 @@ message ChaincodeData {
// InstantiationPolicy for the chaincode
common.SignaturePolicyEnvelope instantiation_policy = 8;
}

// ChaincodeAdditionalParams - parameters passed to chaincode to notify about peer capabilities
message ChaincodeAdditionalParams {
bool use_write_batch = 1; // an indication that the peer can handle state write batches
uint32 max_size_write_batch = 2; // maximum size of batches with write state
}
24 changes: 24 additions & 0 deletions peer/chaincode_shim.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ message ChaincodeMessage {
PUT_STATE_METADATA = 21;
GET_PRIVATE_DATA_HASH = 22;
PURGE_PRIVATE_DATA = 23;
WRITE_BATCH_STATE = 24;
}

Type type = 1;
Expand Down Expand Up @@ -88,6 +89,29 @@ message PutStateMetadata {
StateMetadata metadata = 4;
}

// WriteBatchState - set of records for state changes sent by the batch
message WriteBatchState {
repeated WriteRecord rec = 1;
}

// WriteRecord - single record with changes in the state of different types.
// Filled in depending on the type.
message WriteRecord {
enum Type {
UNDEFINED = 0;
PUT_STATE = 9;
DEL_STATE = 10;
PUT_STATE_METADATA = 21;
PURGE_PRIVATE_DATA = 23;
}

string key = 1;
bytes value = 2;
string collection = 3;
StateMetadata metadata = 4;
Type type = 5;
}

// DelState is the payload of a ChaincodeMessage. It contains a key which
// needs to be recorded in the transaction's write set as a delete operation.
// If the collection is specified, the key needs to be recorded in the
Expand Down
Loading