github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/gossip/api/channel.go (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 package api 18 19 import ( 20 "github.com/hyperledger/fabric/gossip/common" 21 ) 22 23 func init() { 24 // This is just to satisfy the code coverage tool 25 // miss any methods 26 switch true { 27 28 } 29 } 30 31 // SecurityAdvisor defines an external auxiliary object 32 // that provides security and identity related capabilities 33 type SecurityAdvisor interface { 34 // OrgByPeerIdentity returns the OrgIdentityType 35 // of a given peer identity. 36 // If any error occurs, nil is returned. 37 // This method does not validate peerIdentity. 38 // This validation is supposed to be done appropriately during the execution flow. 39 OrgByPeerIdentity(PeerIdentityType) OrgIdentityType 40 } 41 42 // ChannelNotifier is implemented by the gossip component and is used for the peer 43 // layer to notify the gossip component of a JoinChannel event 44 type ChannelNotifier interface { 45 JoinChannel(joinMsg JoinChannelMessage, chainID common.ChainID) 46 } 47 48 // JoinChannelMessage is the message that asserts a creation or mutation 49 // of a channel's membership list, and is the message that is gossipped 50 // among the peers 51 type JoinChannelMessage interface { 52 53 // SequenceNumber returns the sequence number of the configuration block 54 // the JoinChannelMessage originated from 55 SequenceNumber() uint64 56 57 // Members returns the organizations of the channel 58 Members() []OrgIdentityType 59 60 // AnchorPeersOf returns the anchor peers of the given organization 61 AnchorPeersOf(org OrgIdentityType) []AnchorPeer 62 } 63 64 // AnchorPeer is an anchor peer's certificate and endpoint (host:port) 65 type AnchorPeer struct { 66 Host string // Host is the hostname/ip address of the remote peer 67 Port int // Port is the port the remote peer is listening on 68 } 69 70 // OrgIdentityType defines the identity of an organization 71 type OrgIdentityType []byte