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

package gossip

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

Index

Package Files

batcher.go certstore.go chanstate.go config.go gossip.go gossip_impl.go

type Config Uses

type Config struct {
    // BindPort is the port that gossip bind to, used only for tests.
    BindPort int
    // Id of the specific gossip instance.
    ID  string
    // BootstrapPeers are peers we connect to at startup.
    BootstrapPeers []string
    // PropagateIterations is the number of times a message is pushed to remote peers.
    PropagateIterations int
    // PropagatePeerNum is the number of peers selected to push messages to.
    PropagatePeerNum int

    // MaxBlockCountToStore is the maximum count of blocks we store in memory.
    MaxBlockCountToStore int

    // MaxPropagationBurstSize is the max number of messages stored until it triggers a push to remote peers.
    MaxPropagationBurstSize int
    // MaxPropagationBurstLatency is the max time between consecutive message pushes.
    MaxPropagationBurstLatency time.Duration

    // PullInterval determines frequency of pull phases.
    PullInterval time.Duration
    // PullPeerNum is the number of peers to pull from.
    PullPeerNum int

    // SkipBlockVerification controls either we skip verifying block message or not.
    SkipBlockVerification bool

    // PublishCertPeriod is the time from startup certificates are included in Alive message.
    PublishCertPeriod time.Duration
    // PublishStateInfoInterval determines frequency of pushing state info messages to peers.
    PublishStateInfoInterval time.Duration
    // RequestStateInfoInterval determines frequency of pulling state info messages from peers.
    RequestStateInfoInterval time.Duration

    // TLSCerts is the TLS certificates of the peer.
    TLSCerts *common.TLSCertificates

    // InternalEndpoint is the endpoint we publish to peers in our organization.
    InternalEndpoint string
    // ExternalEndpoint is the peer publishes this endpoint instead of selfEndpoint to foreign organizations.
    ExternalEndpoint string
    // TimeForMembershipTracker determines time for polloing with membershipTracker.
    TimeForMembershipTracker time.Duration

    // DigestWaitTime is the time to wait before pull engine processes incoming digests.
    DigestWaitTime time.Duration
    // RequestWaitTime is the time to wait before pull engine removes incoming nonce.
    RequestWaitTime time.Duration
    // ResponseWaitTime is the time to wait before pull engine ends pull.
    ResponseWaitTime time.Duration

    // DialTimeout indicate Dial timeout.
    DialTimeout time.Duration
    // ConnTimeout indicate Connection timeout.
    ConnTimeout time.Duration
    // RecvBuffSize is the buffer size of received message.
    RecvBuffSize int
    // SendBuffSize is the buffer size of sending message.
    SendBuffSize int

    // MsgExpirationTimeout indicate leadership message expiration timeout.
    MsgExpirationTimeout time.Duration

    // AliveTimeInterval is the alive check interval.
    AliveTimeInterval time.Duration
    // AliveExpirationTimeout is the alive expiration timeout.
    AliveExpirationTimeout time.Duration
    // AliveExpirationCheckInterval is the alive expiration check interval.
    AliveExpirationCheckInterval time.Duration
    // ReconnectInterval is the Reconnect interval.
    ReconnectInterval time.Duration
}

Config is the configuration of the gossip component

func GlobalConfig Uses

func GlobalConfig(endpoint string, certs *common.TLSCertificates, bootPeers ...string) (*Config, error)

type GossipImpl Uses

type GossipImpl struct {
    *comm.ChannelDeMultiplexer
    // contains filtered or unexported fields
}

func New Uses

func New(conf *Config, s *grpc.Server, sa api.SecurityAdvisor,
    mcs api.MessageCryptoService, selfIdentity api.PeerIdentityType,
    secureDialOpts api.PeerSecureDialOpts, gossipMetrics *metrics.GossipMetrics) *GossipImpl

New creates a gossip instance attached to a gRPC server

func (*GossipImpl) Accept Uses

func (g *GossipImpl) Accept(acceptor common.MessageAcceptor, passThrough bool) (<-chan *pg.GossipMessage, <-chan protoext.ReceivedMessage)

Accept returns a dedicated read-only channel for messages sent by other nodes that match a certain predicate. If passThrough is false, the messages are processed by the gossip layer beforehand. If passThrough is true, the gossip layer doesn't intervene and the messages can be used to send a reply back to the sender

func (*GossipImpl) Gossip Uses

func (g *GossipImpl) Gossip(msg *pg.GossipMessage)

Gossip sends a message to other peers to the network

func (*GossipImpl) IdentityInfo Uses

func (g *GossipImpl) IdentityInfo() api.PeerIdentitySet

IdentityInfo returns information known peer identities

func (*GossipImpl) IsInMyOrg Uses

func (g *GossipImpl) IsInMyOrg(member discovery.NetworkMember) bool

IsInMyOrg checks whether a network member is in this peer's org

func (*GossipImpl) JoinChan Uses

func (g *GossipImpl) JoinChan(joinMsg api.JoinChannelMessage, channelID common.ChannelID)

func (*GossipImpl) LeaveChan Uses

func (g *GossipImpl) LeaveChan(channelID common.ChannelID)

func (*GossipImpl) PeerFilter Uses

func (g *GossipImpl) PeerFilter(channel common.ChannelID, messagePredicate api.SubChannelSelectionCriteria) (filter.RoutingFilter, error)

PeerFilter receives a SubChannelSelectionCriteria and returns a RoutingFilter that selects only peer identities that match the given criteria, and that they published their channel participation

func (*GossipImpl) Peers Uses

func (g *GossipImpl) Peers() []discovery.NetworkMember

GetPeers returns a mapping of endpoint --> []discovery.NetworkMember

func (*GossipImpl) PeersOfChannel Uses

func (g *GossipImpl) PeersOfChannel(channel common.ChannelID) []discovery.NetworkMember

PeersOfChannel returns the NetworkMembers considered alive and also subscribed to the channel given

func (*GossipImpl) SelfChannelInfo Uses

func (g *GossipImpl) SelfChannelInfo(chain common.ChannelID) *protoext.SignedGossipMessage

SelfChannelInfo returns the peer's latest StateInfo message of a given channel

func (*GossipImpl) SelfMembershipInfo Uses

func (g *GossipImpl) SelfMembershipInfo() discovery.NetworkMember

SelfMembershipInfo returns the peer's membership information

func (*GossipImpl) Send Uses

func (g *GossipImpl) Send(msg *pg.GossipMessage, peers ...*comm.RemotePeer)

Send sends a message to remote peers

func (*GossipImpl) SendByCriteria Uses

func (g *GossipImpl) SendByCriteria(msg *protoext.SignedGossipMessage, criteria SendCriteria) error

SendByCriteria sends a given message to all peers that match the given SendCriteria

func (*GossipImpl) Stop Uses

func (g *GossipImpl) Stop()

Stop stops the gossip component

func (*GossipImpl) SuspectPeers Uses

func (g *GossipImpl) SuspectPeers(isSuspected api.PeerSuspector)

SuspectPeers makes the gossip instance validate identities of suspected peers, and close any connections to peers with identities that are found invalid

func (*GossipImpl) UpdateChaincodes Uses

func (g *GossipImpl) UpdateChaincodes(chaincodes []*pg.Chaincode, channelID common.ChannelID)

UpdateChaincodes updates the chaincodes the peer publishes to other peers in the channel

func (*GossipImpl) UpdateLedgerHeight Uses

func (g *GossipImpl) UpdateLedgerHeight(height uint64, channelID common.ChannelID)

UpdateLedgerHeight updates the ledger height the peer publishes to other peers in the channel

func (*GossipImpl) UpdateMetadata Uses

func (g *GossipImpl) UpdateMetadata(md []byte)

type SendCriteria Uses

type SendCriteria struct {
    Timeout    time.Duration        // Timeout defines the time to wait for acknowledgements
    MinAck     int                  // MinAck defines the amount of peers to collect acknowledgements from
    MaxPeers   int                  // MaxPeers defines the maximum number of peers to send the message to
    IsEligible filter.RoutingFilter // IsEligible defines whether a specific peer is eligible of receiving the message
    Channel    common.ChannelID     // Channel specifies a channel to send this message on. \

}

SendCriteria defines how to send a specific message

func (SendCriteria) String Uses

func (sc SendCriteria) String() string

String returns a string representation of this SendCriteria

Directories

PathSynopsis
algo
channel
msgstore
pull

Package gossip imports 28 packages (graph) and is imported by 11 packages. Updated 2019-11-14. Refresh now. Tools for package owners.