deliverservice

package
v2.2.4-gm Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultReConnectBackoffThreshold   = time.Hour * 1
	DefaultReConnectTotalTimeThreshold = time.Second * 60 * 60
	DefaultConnectionTimeout           = time.Second * 3
)

Variables

This section is empty.

Functions

func LoadOverridesMap

func LoadOverridesMap() (map[string]*orderers.Endpoint, error)

Types

type AddressOverride

type AddressOverride struct {
	From        string `mapstructure:"from"`
	To          string `mapstructure:"to"`
	CACertsFile string `mapstructure:"caCertsFile"`
}

type Config

type Config struct {
	IsStaticLeader bool
	// CryptoSvc performs cryptographic actions like message verification and signing
	// and identity validation.
	CryptoSvc blocksprovider.BlockVerifier
	// 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
	// OrdererSource provides orderer endpoints, complete with TLS cert pools.
	OrdererSource *orderers.ConnectionSource
	// Signer is the identity used to sign requests.
	Signer identity.SignerSerializer
	// GRPC Client
	DeliverGRPCClient *comm.GRPCClient
	// Configuration values for deliver service.
	// TODO: merge 2 Config struct
	DeliverServiceConfig *DeliverServiceConfig
}

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 DeliverAdapter

type DeliverAdapter struct{}

func (DeliverAdapter) Deliver

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

	// 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

func NewDeliverService

func NewDeliverService(conf *Config) DeliverService

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 DeliverServiceConfig

type DeliverServiceConfig struct {
	// PeerTLSEnabled enables/disables Peer TLS.
	PeerTLSEnabled bool
	// BlockGossipEnabled enables block forwarding via gossip
	BlockGossipEnabled bool
	// ReConnectBackoffThreshold sets the delivery service maximal delay between consencutive retries.
	ReConnectBackoffThreshold time.Duration
	// ReconnectTotalTimeThreshold sets the total time the delivery service may spend in reconnection attempts
	// until its retry logic gives up and returns an error.
	ReconnectTotalTimeThreshold time.Duration
	// ConnectionTimeout sets the delivery service <-> ordering service node connection timeout
	ConnectionTimeout time.Duration
	// Keepalive option for deliveryservice
	KeepaliveOptions comm.KeepaliveOptions
	// SecOpts provides the TLS info for connections
	SecOpts comm.SecureOptions

	// OrdererEndpointOverrides is a map of orderer addresses which should be
	// re-mapped to a different orderer endpoint.
	OrdererEndpointOverrides map[string]*orderers.Endpoint
}

DeliverServiceConfig is the struct that defines the deliverservice configuration.

func GlobalConfig

func GlobalConfig() *DeliverServiceConfig

GlobalConfig obtains a set of configuration from viper, build and returns the config struct.

type DialerAdapter

type DialerAdapter struct {
	Client *comm.GRPCClient
}

func (DialerAdapter) Dial

func (da DialerAdapter) Dial(address string, certPool *x509.CertPool) (*grpc.ClientConn, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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