github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/protos/peer/events.proto (about)

     1  /*
     2  Copyright IBM Corp. 2016 All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8  		 http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  syntax = "proto3";
    18  
    19  import "common/common.proto";
    20  import "peer/chaincodeevent.proto";
    21  import "peer/transaction.proto";
    22  
    23  option go_package = "github.com/hyperledger/fabric/protos/peer";
    24  
    25  package protos;
    26  
    27  
    28  //----Event objects----
    29  
    30  enum EventType {
    31          REGISTER = 0;
    32          BLOCK = 1;
    33  	CHAINCODE = 2;
    34  	REJECTION = 3;
    35  }
    36  
    37  //ChaincodeReg is used for registering chaincode Interests
    38  //when EventType is CHAINCODE
    39  message ChaincodeReg {
    40      string chaincode_id = 1;
    41      string event_name = 2;
    42  }
    43  
    44  message Interest {
    45      EventType event_type = 1;
    46      //Ideally we should just have the following oneof for different
    47      //Reg types and get rid of EventType. But this is an API change
    48      //Additional Reg types may add messages specific to their type
    49      //to the oneof.
    50      oneof RegInfo {
    51          ChaincodeReg chaincode_reg_info = 2;
    52      }
    53      string chainID = 3;
    54  }
    55  
    56  //---------- consumer events ---------
    57  //Register is sent by consumers for registering events
    58  //string type - "register"
    59  message Register {
    60      repeated Interest events = 1;
    61  }
    62  
    63  //Rejection is sent by consumers for erroneous transaction rejection events
    64  //string type - "rejection"
    65  message Rejection {
    66      Transaction tx = 1;
    67      string error_msg = 2;
    68  }
    69  
    70  //---------- producer events ---------
    71  message Unregister {
    72      repeated Interest events = 1;
    73  }
    74  
    75  // SignedEvent is used for any communication between consumer and producer
    76  message SignedEvent {
    77      // Signature over the event bytes
    78      bytes signature = 1;
    79      // Marshal of Event object
    80      bytes eventBytes = 2;
    81  }
    82  
    83  //Event is used by
    84  //  - consumers (adapters) to send Register
    85  //  - producer to advertise supported types and events
    86  message Event {
    87      //TODO need timestamp
    88  
    89      oneof Event {
    90          //Register consumer sent event
    91          Register register = 1;
    92  
    93          //producer events
    94          common.Block block = 2;
    95          ChaincodeEvent chaincode_event = 3;
    96          Rejection rejection = 4;
    97  
    98          //Unregister consumer sent events
    99          Unregister unregister = 5;
   100      }
   101      // Creator of the event, specified as a certificate chain
   102      bytes creator = 6;
   103  }
   104  
   105  // Interface exported by the events server
   106  service Events {
   107      // event chatting using Event
   108      rpc Chat(stream Event) returns (stream Event) {}
   109  }