...

Package deliverclient

import "github.com/hyperledger/fabric/core/deliverservice"
Overview
Index
Subdirectories

Overview ▾

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

type Config

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 Config struct {
    // 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
}

type ConnectionCriteria

ConnectionCriteria defines how to connect to ordering service nodes.

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
}

type DeliverService

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

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()
}

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 MessageCryptoVerifier

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

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
}

Subdirectories

Name Synopsis
..
blocksprovider
mocks