github.com/xiaqingdoc/fabric@v2.1.1+incompatible/gossip/api/subchannel.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 "github.com/hyperledger/fabric/gossip/common"
    10  
    11  // RoutingFilter defines which peers should receive a certain message,
    12  // or which peers are eligible of receiving a certain message
    13  type RoutingFilter func(peerIdentity PeerIdentityType) bool
    14  
    15  // SubChannelSelectionCriteria describes a way of selecting peers from a sub-channel
    16  // given their signatures
    17  type SubChannelSelectionCriteria func(signature PeerSignature) bool
    18  
    19  // RoutingFilterFactory defines an object that given a CollectionCriteria and a channel,
    20  // it can ascertain which peers should be aware of the data related to the
    21  // CollectionCriteria.
    22  type RoutingFilterFactory interface {
    23  	// Peers returns a RoutingFilter for given channelID and CollectionCriteria
    24  	Peers(common.ChannelID, SubChannelSelectionCriteria) RoutingFilter
    25  }