deliverclient

package
v0.0.0-...-f69b815 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2023 License: Apache-2.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultABCFactory

func DefaultABCFactory(conn *grpc.ClientConn) orderer.AtomicBroadcastClient

func DefaultConnectionFactory

func DefaultConnectionFactory(channelID string, endpointOverrides map[string]*comm.OrdererEndpoint) func(endpointCriteria comm.EndpointCriteria) (*grpc.ClientConn, error)

func NewBFTDeliveryClient

func NewBFTDeliveryClient(
	chainID string,
	connFactory comm.ConnectionFactory,
	endpoints []comm.EndpointCriteria,
	clFactory clientFactory,
	ledgerInfoProvider blocksprovider.LedgerInfo,
	msgVerifier MessageCryptoVerifier,
) *bftDeliveryClient

func NewBroadcastClient

func NewBroadcastClient(prod comm.ConnectionProducer, clFactory clientFactory, onConnect broadcastSetup, bos retryPolicy) *broadcastClient

NewBroadcastClient returns a broadcastClient with the given params

func NewDeliverService

func NewDeliverService(conf *Config, connConfig ConnectionCriteria) (*deliverServiceImpl, error)

NewDeliverService construction function to create and initialize delivery service instance. It tries to establish connection to the specified in the configuration ordering service, in case it fails to dial to it, return nil

Types

type Config

type Config struct {
	IsStaticLeader bool
	// ConnFactory returns a function that creates a connection to an endpoint
	ConnFactory func(channelID string, endpointOverrides map[string]*comm.OrdererEndpoint) func(endpointCriteria comm.EndpointCriteria) (*grpc.ClientConn, error)
	// ABCFactory creates an AtomicBroadcastClient out of a connection
	ABCFactory func(*grpc.ClientConn) orderer.AtomicBroadcastClient
	// CryptoSvc performs cryptographic actions like message verification and signing
	// and identity validation
	CryptoSvc api.MessageCryptoService
	// Gossip enables to enumerate peers in the channel, send a message to peers,
	// and add a block to the gossip state transfer layer
	Gossip blocksprovider.GossipServiceAdapter
}

Config dictates the DeliveryService's properties, namely how it connects to an ordering service endpoint, how it verifies messages received from it, and how it disseminates the messages to other peers

type ConnectionCriteria

type ConnectionCriteria struct {
	// Endpoints specifies the endpoints of the ordering service.
	OrdererEndpoints []string
	// Organizations denotes a list of organizations
	Organizations []string
	// OrdererEndpointsByOrg specifies the endpoints of the ordering service grouped by orgs.
	OrdererEndpointsByOrg map[string][]string
	// OrdererEndpointOverrides specifies a map of endpoints to override.  The map
	// key is the configured endpoint address to match and the value is the
	// endpoint to use instead.
	OrdererEndpointOverrides map[string]*comm.OrdererEndpoint
}

ConnectionCriteria defines how to connect to ordering service nodes.

type DeliverService

type DeliverService interface {
	// StartDeliverForChannel dynamically starts delivery of new blocks from ordering service
	// to channel peers.
	// When the delivery finishes, the finalizer func is called
	StartDeliverForChannel(chainID string, ledgerInfo blocksprovider.LedgerInfo, finalizer func()) error

	// StopDeliverForChannel dynamically stops delivery of new blocks from ordering service
	// to channel peers.
	StopDeliverForChannel(chainID string) error

	// UpdateEndpoints updates the ordering endpoints for the given chain.
	UpdateEndpoints(chainID string, connCriteria ConnectionCriteria) error

	// Stop terminates delivery service and closes the connection
	Stop()
}

DeliverService used to communicate with orderers to obtain new blocks and send them to the committer service

type EndpointUpdater

type EndpointUpdater interface {
	// UpdateEndpoints updates the endpoint of the underlying client
	UpdateEndpoints(endpoints []comm.EndpointCriteria)
	// GetEndpoint retrieves the orderer endpoint from which the client is receiving blocks (as opposed to headers)
	GetEndpoint() string
}

type HeaderStreamClient

type HeaderStreamClient interface {
	blocksprovider.StreamClient
	EndpointUpdater
}

type MessageCryptoVerifier

type MessageCryptoVerifier interface {
	// VerifyHeader returns nil when the header matches the metadata signature, but it does not compute the
	// block.Data.Hash() and compare it to the block.Header.DataHash, or otherwise inspect the block.Data.
	// This is used when the orderer delivers a block with header & metadata only (i.e. block.Data==nil).
	// See: gossip/api/MessageCryptoService
	VerifyHeader(chainID string, signedBlock *common.Block) error
}

MessageCryptoVerifier defines message verification methods, and is subset of gossip/api/MessageCryptoService.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL