github.com/yimialmonte/fabric@v2.1.1+incompatible/gossip/api/channel.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package api
     8  
     9  import (
    10  	"github.com/hyperledger/fabric/gossip/common"
    11  )
    12  
    13  //go:generate mockery -dir . -name SecurityAdvisor -case underscore -output mocks/
    14  
    15  // SecurityAdvisor defines an external auxiliary object
    16  // that provides security and identity related capabilities
    17  type SecurityAdvisor interface {
    18  	// OrgByPeerIdentity returns the OrgIdentityType
    19  	// of a given peer identity.
    20  	// If any error occurs, nil is returned.
    21  	// This method does not validate peerIdentity.
    22  	// This validation is supposed to be done appropriately during the execution flow.
    23  	OrgByPeerIdentity(PeerIdentityType) OrgIdentityType
    24  }
    25  
    26  // ChannelNotifier is implemented by the gossip component and is used for the peer
    27  // layer to notify the gossip component of a JoinChannel event
    28  type ChannelNotifier interface {
    29  	JoinChannel(joinMsg JoinChannelMessage, channelID common.ChannelID)
    30  }
    31  
    32  // JoinChannelMessage is the message that asserts a creation or mutation
    33  // of a channel's membership list, and is the message that is gossipped
    34  // among the peers
    35  type JoinChannelMessage interface {
    36  
    37  	// SequenceNumber returns the sequence number of the configuration block
    38  	// the JoinChannelMessage originated from
    39  	SequenceNumber() uint64
    40  
    41  	// Members returns the organizations of the channel
    42  	Members() []OrgIdentityType
    43  
    44  	// AnchorPeersOf returns the anchor peers of the given organization
    45  	AnchorPeersOf(org OrgIdentityType) []AnchorPeer
    46  }
    47  
    48  // AnchorPeer is an anchor peer's certificate and endpoint (host:port)
    49  type AnchorPeer struct {
    50  	Host string // Host is the hostname/ip address of the remote peer
    51  	Port int    // Port is the port the remote peer is listening on
    52  }
    53  
    54  // OrgIdentityType defines the identity of an organization
    55  type OrgIdentityType []byte