github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/gossip/common/common.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package common 8 9 func init() { 10 // This is just to satisfy the code coverage tool 11 // miss any methods 12 switch true { 13 14 } 15 } 16 17 // PKIidType defines the type that holds the PKI-id 18 // which is the security identifier of a peer 19 type PKIidType []byte 20 21 // MessageAcceptor is a predicate that is used to 22 // determine in which messages the subscriber that created the 23 // instance of the MessageAcceptor is interested in. 24 type MessageAcceptor func(interface{}) bool 25 26 // Payload defines an object that contains a ledger block 27 type Payload struct { 28 ChainID ChainID // The channel's ID of the block 29 Data []byte // The content of the message, possibly encrypted or signed 30 Hash string // The message hash 31 SeqNum uint64 // The message sequence number 32 } 33 34 // ChainID defines the identity representation of a chain 35 type ChainID []byte 36 37 // MessageReplacingPolicy Returns: 38 // MESSAGE_INVALIDATES if this message invalidates that 39 // MESSAGE_INVALIDATED if this message is invalidated by that 40 // MESSAGE_NO_ACTION otherwise 41 type MessageReplacingPolicy func(this interface{}, that interface{}) InvalidationResult 42 43 // InvalidationResult determines how a message affects another message 44 // when it is put into gossip message store 45 type InvalidationResult int 46 47 const ( 48 // MessageNoAction means messages have no relation 49 MessageNoAction InvalidationResult = iota 50 // MessageInvalidates means message invalidates the other message 51 MessageInvalidates 52 // MessageInvalidated means message is invalidated by the other message 53 MessageInvalidated 54 )