github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/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  // SecurityAdvisor defines an external auxiliary object
    24  // that provides security and identity related capabilities
    25  type SecurityAdvisor interface {
    26  	// OrgByPeerIdentity returns the OrgIdentityType
    27  	// of a given peer identity.
    28  	// If any error occurs, nil is returned.
    29  	// This method does not validate peerIdentity.
    30  	// This validation is supposed to be done appropriately during the execution flow.
    31  	OrgByPeerIdentity(PeerIdentityType) OrgIdentityType
    32  }
    33  
    34  // ChannelNotifier is implemented by the gossip component and is used for the peer
    35  // layer to notify the gossip component of a JoinChannel event
    36  type ChannelNotifier interface {
    37  	JoinChannel(joinMsg JoinChannelMessage, chainID common.ChainID)
    38  }
    39  
    40  // JoinChannelMessage is the message that asserts a creation or mutation
    41  // of a channel's membership list, and is the message that is gossipped
    42  // among the peers
    43  type JoinChannelMessage interface {
    44  
    45  	// SequenceNumber returns the sequence number of the configuration block
    46  	// the JoinChannelMessage originated from
    47  	SequenceNumber() uint64
    48  
    49  	// AnchorPeers returns all the anchor peers that are in the channel
    50  	AnchorPeers() []AnchorPeer
    51  }
    52  
    53  // AnchorPeer is an anchor peer's certificate and endpoint (host:port)
    54  type AnchorPeer struct {
    55  	Host  string          // Host is the hostname/ip address of the remote peer
    56  	Port  int             // Port is the port the remote peer is listening on
    57  	OrgID OrgIdentityType // OrgID is the identity of the organization the anchor peer came from
    58  
    59  }
    60  
    61  // OrgIdentityType defines the identity of an organization
    62  type OrgIdentityType []byte