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

package service

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

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Package Files

config.go eventer.go gossip_service.go

type Config Uses

type Config interface {
    // ChannelID returns the ChannelID for this channel
    ChannelID() string

    // Organizations returns a map of org ID to ApplicationOrgConfig
    Organizations() map[string]channelconfig.ApplicationOrg

    // Sequence should return the sequence number of the current configuration
    Sequence() uint64

    // OrdererAddresses returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver
    OrdererAddresses() []string
}

Config enumerates the configuration methods required by gossip

type ConfigProcessor Uses

type ConfigProcessor interface {
    // ProcessConfigUpdate should be invoked whenever a channel's configuration is initialized or updated
    ProcessConfigUpdate(config Config)
}

ConfigProcessor receives config updates

type DeliveryServiceFactory Uses

type DeliveryServiceFactory interface {
    // Returns an instance of delivery client
    Service(g GossipServiceAdapter, ordererSource *orderers.ConnectionSource, msc api.MessageCryptoService, isStaticLead bool) deliverservice.DeliverService
}

DeliveryServiceFactory factory to create and initialize delivery service instance

type GossipService Uses

type GossipService struct {
    // contains filtered or unexported fields
}

func New Uses

func New(
    peerIdentity identity.SignerSerializer,
    gossipMetrics *gossipmetrics.GossipMetrics,
    endpoint string,
    s *grpc.Server,
    mcs api.MessageCryptoService,
    secAdv api.SecurityAdvisor,
    secureDialOpts api.PeerSecureDialOpts,
    credSupport *corecomm.CredentialSupport,
    deliverGRPCClient *corecomm.GRPCClient,
    gossipConfig *gossip.Config,
    serviceConfig *ServiceConfig,
    deliverServiceConfig *deliverservice.DeliverServiceConfig,
) (*GossipService, error)

New creates the gossip service.

func (*GossipService) AddPayload Uses

func (g *GossipService) AddPayload(channelID string, payload *gproto.Payload) error

AddPayload appends message payload to for given chain

func (*GossipService) DistributePrivateData Uses

func (g *GossipService) DistributePrivateData(channelID string, txID string, privData *tspb.TxPvtReadWriteSetWithConfigInfo, blkHt uint64) error

DistributePrivateData distribute private read write set inside the channel based on the collections policies

func (*GossipService) InitializeChannel Uses

func (g *GossipService) InitializeChannel(channelID string, ordererSource *orderers.ConnectionSource, store *transientstore.Store, support Support)

InitializeChannel allocates the state provider and should be invoked once per channel per execution

func (*GossipService) NewConfigEventer Uses

func (g *GossipService) NewConfigEventer() ConfigProcessor

NewConfigEventer creates a ConfigProcessor which the channelconfig.BundleSource can ultimately route config updates to

func (*GossipService) Stop Uses

func (g *GossipService) Stop()

Stop stops the gossip component

type GossipServiceAdapter Uses

type GossipServiceAdapter interface {
    // PeersOfChannel returns slice with members of specified channel
    PeersOfChannel(gossipcommon.ChannelID) []discovery.NetworkMember

    // AddPayload adds payload to the local state sync buffer
    AddPayload(channelID string, payload *gproto.Payload) error

    // Gossip the message across the peers
    Gossip(msg *gproto.GossipMessage)
}

GossipServiceAdapter serves to provide basic functionality required from gossip service by delivery service

type ServiceConfig Uses

type ServiceConfig struct {
    // PeerTLSEnabled enables/disables Peer TLS.
    PeerTLSEnabled bool
    // Endpoint which overrides the endpoint the peer publishes to peers in its organization.
    Endpoint              string
    NonBlockingCommitMode bool
    // UseLeaderElection defines whenever peer will initialize dynamic algorithm for "leader" selection.
    UseLeaderElection bool
    // OrgLeader statically defines peer to be an organization "leader".
    OrgLeader bool
    // ElectionStartupGracePeriod is the longest time peer waits for stable membership during leader
    // election startup (unit: second).
    ElectionStartupGracePeriod time.Duration
    // ElectionMembershipSampleInterval is the time interval for gossip membership samples to check its stability (unit: second).
    ElectionMembershipSampleInterval time.Duration
    // ElectionLeaderAliveThreshold is the time passes since last declaration message before peer decides to
    // perform leader election (unit: second).
    ElectionLeaderAliveThreshold time.Duration
    // ElectionLeaderElectionDuration is the time passes since last declaration message before peer decides to perform
    // leader election (unit: second).
    ElectionLeaderElectionDuration time.Duration
    // PvtDataPullRetryThreshold determines the maximum duration of time private data corresponding for
    // a given block.
    PvtDataPullRetryThreshold time.Duration
    // PvtDataPushAckTimeout is the maximum time to wait for the acknoledgement from each peer at private
    // data push at endorsement time.
    PvtDataPushAckTimeout time.Duration
    // BtlPullMargin is the block to live pulling margin, used as a buffer to prevent peer from trying to pull private data
    // from peers that is soon to be purged in next N blocks.
    BtlPullMargin uint64
    // TransientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit,
    // and the private data residing inside the transient store that is guaranteed not to be purged.
    TransientstoreMaxBlockRetention uint64
    // SkipPullingInvalidTransactionsDuringCommit is a flag that indicates whether pulling of invalid
    // transaction's private data from other peers need to be skipped during the commit time and pulled
    // only through reconciler.
    SkipPullingInvalidTransactionsDuringCommit bool
}

ServiceConfig is the config struct for gossip services

func GlobalConfig Uses

func GlobalConfig() *ServiceConfig

type Support Uses

type Support struct {
    Validator            txvalidator.Validator
    Committer            committer.Committer
    CollectionStore      privdata.CollectionStore
    IdDeserializeFactory gossipprivdata.IdentityDeserializerFactory
    CapabilityProvider   gossipprivdata.CapabilityProvider
}

Support aggregates functionality of several interfaces required by gossip service

Directories

PathSynopsis
mocksCode generated by counterfeiter.

Package service imports 33 packages (graph) and is imported by 49 packages. Updated 2020-02-15. Refresh now. Tools for package owners.