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

package pull

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


Package Files


func SelectEndpoints Uses

func SelectEndpoints(k int, peerPool []discovery.NetworkMember) []*comm.RemotePeer

SelectEndpoints select k peers from peerPool and returns them.

type Config Uses

type Config struct {
    ID                string
    PullInterval      time.Duration // Duration between pull invocations
    Channel           common.ChannelID
    PeerCountToSelect int // Number of peers to initiate pull with
    Tag               proto.GossipMessage_Tag
    MsgType           proto.PullMsgType
    PullEngineConfig  algo.PullEngineConfig

Config defines the configuration of the pull mediator

type EgressDigestFilter Uses

type EgressDigestFilter func(helloMsg protoext.ReceivedMessage) func(digestItem string) bool

EgressDigestFilter filters digests to be sent to a remote peer, that sent a hello with the following message

type IdentifierExtractor Uses

type IdentifierExtractor func(*protoext.SignedGossipMessage) string

IdentifierExtractor extracts from a SignedGossipMessage an identifier

type IngressDigestFilter Uses

type IngressDigestFilter func(digestMsg *proto.DataDigest) *proto.DataDigest

IngressDigestFilter filters out entities in digests that are received from remote peers

type Mediator Uses

type Mediator interface {
    // Stop stop the Mediator

    // RegisterMsgHook registers a message hook to a specific type of pull message
    RegisterMsgHook(MsgType, MessageHook)

    // Add adds a GossipMessage to the Mediator

    // Remove removes a GossipMessage from the Mediator with a matching digest,
    // if such a message exits
    Remove(digest string)

    // HandleMessage handles a message from some remote peer
    HandleMessage(msg protoext.ReceivedMessage)

Mediator is a component wrap a PullEngine and provides the methods it needs to perform pull synchronization. The specialization of a pull mediator to a certain type of message is done by the configuration, a IdentifierExtractor, IdentifierExtractor given at construction, and also hooks that can be registered for each type of pullMsgType (hello, digest, req, res).

func NewPullMediator Uses

func NewPullMediator(config Config, adapter *PullAdapter) Mediator

NewPullMediator returns a new Mediator

type MembershipService Uses

type MembershipService interface {
    // GetMembership returns the membership of
    GetMembership() []discovery.NetworkMember

MembershipService obtains membership information of alive peers

type MessageHook Uses

type MessageHook func(itemIDs []string, items []*protoext.SignedGossipMessage, msg protoext.ReceivedMessage)

MessageHook defines a function that will run after a certain pull message is received

type MsgConsumer Uses

type MsgConsumer func(message *protoext.SignedGossipMessage)

MsgConsumer invokes code given a SignedGossipMessage

type MsgType Uses

type MsgType int

MsgType defines the type of a message that is sent to the PullStore

const (
    HelloMsgType MsgType = iota

Constants go here.

type PullAdapter Uses

type PullAdapter struct {
    Sndr             Sender
    MemSvc           MembershipService
    IdExtractor      IdentifierExtractor
    MsgCons          MsgConsumer
    EgressDigFilter  EgressDigestFilter
    IngressDigFilter IngressDigestFilter

PullAdapter defines methods of the pullStore to interact with various modules of gossip

type Sender Uses

type Sender interface {
    // Send sends a message to a list of remote peers
    Send(msg *protoext.SignedGossipMessage, peers ...*comm.RemotePeer)

Sender sends messages to remote peers

Package pull imports 12 packages (graph) and is imported by 24 packages. Updated 2020-07-11. Refresh now. Tools for package owners.