github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/protos/gossip/message.proto (about) 1 syntax = "proto3"; 2 3 option go_package = "github.com/hyperledger/fabric/protos/gossip" ; 4 5 package gossip; 6 7 8 // Gossip 9 service Gossip { 10 11 // GossipStream is the gRPC stream used for sending and receiving messages 12 rpc GossipStream (stream Envelope) returns (stream Envelope) {} 13 14 // Ping is used to probe a remote peer's aliveness 15 rpc Ping (Empty) returns (Empty) {} 16 } 17 18 19 // Envelope contains a marshalled 20 // GossipMessage and a signature over it. 21 // It may also contain a SecretEnvelope 22 // which is a marshalled Secret 23 message Envelope { 24 bytes payload = 1; 25 bytes signature = 2; 26 SecretEnvelope secretEnvelope = 3; 27 } 28 29 // SecretEnvelope is a marshalled Secret 30 // and a signature over it. 31 // The signature should be validated by the peer 32 // that signed the Envelope the SecretEnvelope 33 // came with 34 message SecretEnvelope { 35 bytes payload = 1; 36 bytes signature = 2; 37 } 38 39 // Secret is an entity that might be omitted 40 // from an Envelope when the remote peer that is receiving 41 // the Envelope shouldn't know the secret's content. 42 message Secret { 43 oneof content { 44 string internalEndpoint = 1; 45 } 46 } 47 48 // GossipMessage defines the message sent in a gossip network 49 message GossipMessage { 50 51 // used mainly for testing, but will might be used in the future 52 // for ensuring message delivery by acking 53 uint64 nonce = 1; 54 55 // The channel of the message. 56 // Some GossipMessages may set this to nil, because 57 // they are cross-channels but some may not 58 bytes channel = 2; 59 60 61 enum Tag { 62 UNDEFINED = 0; 63 EMPTY = 1; 64 ORG_ONLY = 2; 65 CHAN_ONLY = 3; 66 CHAN_AND_ORG = 4; 67 CHAN_OR_ORG = 5; 68 } 69 70 // determines to which peers it is allowed 71 // to forward the message 72 Tag tag = 3; 73 74 oneof content { 75 // Membership 76 AliveMessage aliveMsg = 5; 77 MembershipRequest memReq = 6; 78 MembershipResponse memRes = 7; 79 80 // Contains a ledger block 81 DataMessage dataMsg = 8; 82 83 // Used for push&pull 84 GossipHello hello = 9; 85 DataDigest dataDig = 10; 86 DataRequest dataReq = 11; 87 DataUpdate dataUpdate = 12; 88 89 // Empty message, used for pinging 90 Empty empty = 13; 91 92 // ConnEstablish, used for establishing a connection 93 ConnEstablish conn = 14; 94 95 // Used for relaying information 96 // about state 97 StateInfo stateInfo = 15; 98 99 // Used for sending sets of StateInfo messages 100 StateInfoSnapshot stateSnapshot = 16; 101 102 // Used for asking for StateInfoSnapshots 103 StateInfoPullRequest stateInfoPullReq = 17; 104 105 // Used to ask from a remote peer a set of blocks 106 RemoteStateRequest stateRequest = 18; 107 108 // Used to send a set of blocks to a remote peer 109 RemoteStateResponse stateResponse = 19; 110 111 // Used to indicate intent of peer to become leader 112 LeadershipMessage leadershipMsg = 20; 113 114 // Used to learn of a peer's certificate 115 PeerIdentity peerIdentity = 21; 116 } 117 } 118 119 // StateInfo is used for a peer to relay its state information 120 // to other peers 121 message StateInfo { 122 bytes metadata = 1; 123 PeerTime timestamp = 2; 124 bytes pkiID = 3; 125 } 126 127 // StateInfoSnapshot is an aggregation of StateInfo messages 128 message StateInfoSnapshot { 129 repeated Envelope elements = 1; 130 } 131 132 // StateInfoPullRequest is used to fetch a StateInfoSnapshot 133 // from a remote peer 134 message StateInfoPullRequest { 135 136 } 137 138 // ConnEstablish is the message used for the gossip handshake 139 // Whenever a peer connects to another peer, it handshakes 140 // with it by sending this message that proves its identity 141 message ConnEstablish { 142 bytes pkiID = 1; 143 bytes cert = 2; 144 bytes hash = 3; 145 } 146 147 // PeerIdentity defines the identity of the peer 148 // Used to make other peers learn of the identity 149 // of a certain peer 150 message PeerIdentity { 151 bytes pkiID = 1; 152 bytes cert = 2; 153 bytes metadata = 3; 154 } 155 156 // Messages related to pull mechanism 157 158 enum PullMsgType { 159 Undefined = 0; 160 BlockMessage = 1; 161 IdentityMsg = 2; 162 } 163 164 // DataRequest is a message used for a peer to request 165 // certain data blocks from a remote peer 166 message DataRequest { 167 uint64 nonce = 1; 168 repeated string digests = 2; 169 PullMsgType msgType = 3; 170 } 171 172 // GossipHello is the message that is used for the peer to initiate 173 // a pull round with another peer 174 message GossipHello { 175 uint64 nonce = 1; 176 bytes metadata = 2; 177 PullMsgType msgType = 3; 178 } 179 180 // DataUpdate is the the final message in the pull phase 181 // sent from the receiver to the initiator 182 message DataUpdate { 183 uint64 nonce = 1; 184 repeated Envelope data = 2; 185 PullMsgType msgType = 3; 186 } 187 188 // DataDigest is the message sent from the receiver peer 189 // to the initator peer and contains the data items it has 190 message DataDigest { 191 uint64 nonce = 1; 192 repeated string digests = 2; // Maybe change this to bitmap later on 193 PullMsgType msgType = 3; 194 } 195 196 197 // Ledger block messages 198 199 // DataMessage is the message that contains a block 200 message DataMessage { 201 Payload payload = 1; 202 } 203 204 // Payload contains a block 205 message Payload { 206 uint64 seqNum = 1; 207 string hash = 2; 208 bytes data = 3; 209 } 210 211 212 // Membership messages 213 214 // AliveMessage is sent to inform remote peers 215 // of a peer's existence and activity 216 message AliveMessage { 217 Member membership = 1; 218 PeerTime timestamp = 2; 219 bytes identity = 4; 220 } 221 222 // Leadership Message is sent during leader election to inform 223 // remote peers about intent of peer to proclaim itself as leader 224 message LeadershipMessage { 225 bytes pkiID = 1; 226 PeerTime timestamp = 2; 227 bool isDeclaration = 3; 228 } 229 230 // PeerTime defines the logical time of a peer's life 231 message PeerTime { 232 uint64 inc_number = 1; 233 uint64 seqNum = 2; 234 } 235 236 // MembershipRequest is used to ask membership information 237 // from a remote peer 238 message MembershipRequest { 239 Envelope selfInformation = 1; 240 repeated bytes known = 2; 241 } 242 243 // MembershipResponse is used for replying to MembershipRequests 244 message MembershipResponse { 245 repeated Envelope alive = 1; 246 repeated Envelope dead = 2; 247 } 248 249 // Member holds membership-related information 250 // about a peer 251 message Member { 252 string endpoint = 1; 253 bytes metadata = 2; 254 bytes pkiID = 3; 255 } 256 257 258 // Empty is used for pinging and in tests 259 message Empty {} 260 261 262 // State transfer 263 264 // RemoteStateRequest is used to ask a set of blocks 265 // from a remote peer 266 message RemoteStateRequest { 267 repeated uint64 seqNums = 1; 268 } 269 270 // RemoteStateResponse is used to send a set of blocks 271 // to a remote peer 272 message RemoteStateResponse { 273 repeated Payload payloads = 1; 274 }