Skip to content

Commit

Permalink
add protobuf changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Srinivasan Muralidharan authored and Patrick Mullaney committed Jun 7, 2016
1 parent f4e6c3d commit acfba26
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 20 deletions.
3 changes: 3 additions & 0 deletions protos/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions protos/chaincode.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions protos/chaincode.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ syntax = "proto3";

package protos;

import "chaincodeevent.proto";
import "google/protobuf/timestamp.proto";


Expand Down Expand Up @@ -141,6 +142,11 @@ message ChaincodeMessage {
bytes payload = 3;
string uuid = 4;
ChaincodeSecurityContext securityContext = 5;

//event emmited by chaincode. Used only with Init or Invoke.
// This event is then stored (currently)
//with Block.NonHashData.TransactionResult
ChaincodeEvent chaincodeEvent = 6;
}

message PutStateInfo {
Expand Down
26 changes: 26 additions & 0 deletions protos/chaincodeevent.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions protos/chaincodeevent.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
syntax = "proto3";
package protos;

//Chaincode is used for events and registrations that are specific to chaincode
//string type - "chaincode"
message ChaincodeEvent {
string uuid = 1;
string eventName = 2;
bytes payload = 3;
}
83 changes: 77 additions & 6 deletions protos/events.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions protos/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

syntax = "proto3";

import "chaincodeevent.proto";
import "fabric.proto";

package protos;
Expand All @@ -30,6 +31,14 @@ enum EventType {
CHAINCODE = 3;
}

//ChaincodeReg is used for registering chaincode Interests
//when EventType is CHAINCODE
message ChaincodeReg {
string uuid = 1;
string eventname = 2;
bool anyTransaction = 3;
}

message Interest {
enum ResponseType {
//don't send events (used to cancel interest)
Expand All @@ -41,7 +50,7 @@ message Interest {
}
EventType eventType = 1;
ResponseType responseType = 2;
Chaincode chainEvent = 3;
ChaincodeReg chainEvent = 3;
}

//---------- consumer events ---------
Expand All @@ -59,14 +68,6 @@ message Generic {
bytes payload = 2;
}

//Chaincode is used for events and registrations that are specific to chaincode
//string type - "chaincode"
message Chaincode {
string uuid = 1;
bool transactions = 2;
string eventname = 3;
bytes payload = 4;
}
//Event is used by
// - consumers (adapters) to send Register
// - producer to advertise supported types and events
Expand All @@ -80,7 +81,7 @@ message Event {
//producer events
Block block = 2;
Generic generic = 3;
Chaincode chaincode = 4;
ChaincodeEvent chaincodeEvent = 4;
}
}

Expand Down
17 changes: 13 additions & 4 deletions protos/fabric.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions protos/fabric.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.
syntax = "proto3";
package protos;
import "chaincode.proto";
import "chaincodeevent.proto";
import "google/protobuf/timestamp.proto";


Expand Down Expand Up @@ -64,11 +65,13 @@ message TransactionBlock {
// result - The return value of the transaction.
// errorCode - An error code. 5xx will be logged as a failure in the dashboard.
// error - An error string for logging an issue.
// chaincodeEvent - any event emitted by a transaction
message TransactionResult {
string uuid = 1;
bytes result = 2;
uint32 errorCode = 3;
string error = 4;
ChaincodeEvent chaincodeEvent = 5;
}

// Block carries The data that describes a block in the blockchain.
Expand Down

0 comments on commit acfba26

Please sign in to comment.