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

package algo

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

Index

Package Files

pull.go

Constants

const (
    DefDigestWaitTime   = 1000 * time.Millisecond
    DefRequestWaitTime  = 1500 * time.Millisecond
    DefResponseWaitTime = 2000 * time.Millisecond
)

type DigestFilter Uses

type DigestFilter func(context interface{}) func(digestItem string) bool

DigestFilter filters digests to be sent to a remote peer that sent a hello or a request, based on its messages's context

type PullAdapter Uses

type PullAdapter interface {
    // SelectPeers returns a slice of peers which the engine will initiate the protocol with
    SelectPeers() []string

    // Hello sends a hello message to initiate the protocol
    // and returns an NONCE that is expected to be returned
    // in the digest message.
    Hello(dest string, nonce uint64)

    // SendDigest sends a digest to a remote PullEngine.
    // The context parameter specifies the remote engine to send to.
    SendDigest(digest []string, nonce uint64, context interface{})

    // SendReq sends an array of items to a certain remote PullEngine identified
    // by a string
    SendReq(dest string, items []string, nonce uint64)

    // SendRes sends an array of items to a remote PullEngine identified by a context.
    SendRes(items []string, context interface{}, nonce uint64)
}

PullAdapter is needed by the PullEngine in order to send messages to the remote PullEngine instances. The PullEngine expects to be invoked with OnHello, OnDigest, OnReq, OnRes when the respective message arrives from a remote PullEngine

type PullEngine Uses

type PullEngine struct {
    PullAdapter
    // contains filtered or unexported fields
}

PullEngine is the component that actually invokes the pull algorithm with the help of the PullAdapter

func NewPullEngine Uses

func NewPullEngine(participant PullAdapter, sleepTime time.Duration, config PullEngineConfig) *PullEngine

NewPullEngine creates an instance of a PullEngine with a certain sleep time between pull initiations

func NewPullEngineWithFilter Uses

func NewPullEngineWithFilter(participant PullAdapter, sleepTime time.Duration, df DigestFilter,
    config PullEngineConfig) *PullEngine

NewPullEngineWithFilter creates an instance of a PullEngine with a certain sleep time between pull initiations, and uses the given filters when sending digests and responses

func (*PullEngine) Add Uses

func (engine *PullEngine) Add(seqs ...string)

Add adds items to the state

func (*PullEngine) OnDigest Uses

func (engine *PullEngine) OnDigest(digest []string, nonce uint64, context interface{})

OnDigest notifies the engine that a digest has arrived

func (*PullEngine) OnHello Uses

func (engine *PullEngine) OnHello(nonce uint64, context interface{})

OnHello notifies the engine a hello has arrived

func (*PullEngine) OnReq Uses

func (engine *PullEngine) OnReq(items []string, nonce uint64, context interface{})

OnReq notifies the engine a request has arrived

func (*PullEngine) OnRes Uses

func (engine *PullEngine) OnRes(items []string, nonce uint64)

OnRes notifies the engine a response has arrived

func (*PullEngine) Remove Uses

func (engine *PullEngine) Remove(seqs ...string)

Remove removes items from the state

func (*PullEngine) Stop Uses

func (engine *PullEngine) Stop()

Stop stops the engine

type PullEngineConfig Uses

type PullEngineConfig struct {
    DigestWaitTime   time.Duration
    RequestWaitTime  time.Duration
    ResponseWaitTime time.Duration
}

PullEngineConfig is the configuration required to initialize a new pull engine

Package algo imports 4 packages (graph) and is imported by 4 packages. Updated 2019-04-23. Refresh now. Tools for package owners.