fabric: github.com/hyperledger/fabric/gossip/filter Index | Files

package filter

import "github.com/hyperledger/fabric/gossip/filter"


Package Files



var SelectAllPolicy = func(discovery.NetworkMember) bool {
    return true

SelectAllPolicy selects all members given

var SelectNonePolicy = func(discovery.NetworkMember) bool {
    return false

SelectNonePolicy selects an empty set of members

func AnyMatch Uses

func AnyMatch(peerPool []discovery.NetworkMember, filters ...RoutingFilter) []discovery.NetworkMember

AnyMatch filters out peers that don't match any of the given filters

func First Uses

func First(peerPool []discovery.NetworkMember, filter RoutingFilter) *comm.RemotePeer

First returns the first peer that matches the given filter

func SelectPeers Uses

func SelectPeers(k int, peerPool []discovery.NetworkMember, filter RoutingFilter) []*comm.RemotePeer

SelectPeers returns a slice of at most k peers randomly chosen from peerPool that match routingFilter filter.

type RoutingFilter Uses

type RoutingFilter func(discovery.NetworkMember) bool

RoutingFilter defines a predicate on a NetworkMember It is used to assert whether a given NetworkMember should be selected for be given a message

func CombineRoutingFilters Uses

func CombineRoutingFilters(filters ...RoutingFilter) RoutingFilter

CombineRoutingFilters returns the logical AND of given routing filters

Package filter imports 4 packages (graph) and is imported by 34 packages. Updated 2020-07-11. Refresh now. Tools for package owners.