deliverservice

package
v0.0.0-...-579b097 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultReConnectBackoffThreshold   = time.Hour * 1
	DefaultReConnectTotalTimeThreshold = time.Second * 60 * 60
	DefaultConnectionTimeout           = time.Second * 3
	DefaultBlockCensorshipTimeoutKey   = time.Second * 30
	DefaultMinimalReconnectInterval    = time.Millisecond * 100
)

Variables

This section is empty.

Functions

func LoadOverridesMap

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

Types

type AddressOverride

type AddressOverride struct {
	From        string
	To          string
	CACertsFile string
}

type BlockDeliverer

type BlockDeliverer interface {
	Stop()
	DeliverBlocks()
}

BlockDeliverer communicates with orderers to obtain new blocks and send them to the committer service, for a specific channel. It can be implemented using different protocols depending on the ordering service consensus type, e.g CFT (etcdraft) or BFT (SmartBFT).

type Config

type Config struct {
	IsStaticLeader bool
	// 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
	// OrdererEndpointOverrides provides peer-specific orderer endpoints overrides.
	// These are loaded once when the peer starts.
	OrdererEndpointOverrides map[string]*orderers.Endpoint
	// Signer is the identity used to sign requests.
	Signer identity.SignerSerializer
	// DeliverServiceConfig is the configuration object.
	DeliverServiceConfig *DeliverServiceConfig
	// ChannelConfig the initial channel config.
	ChannelConfig *common.Config
	// CryptoProvider the crypto service provider.
	CryptoProvider bccsp.BCCSP
}

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 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. StartDeliverForChannel can be called again, and delivery will resume.
	StopDeliverForChannel() error

	// Stop terminates delivery service and closes the connection. Marks the service as stopped, meaning that
	// StartDeliverForChannel cannot be called again.
	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 consecutive 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
	// If a certain header from a header receiver is in front of the block receiver for more that this time, a
	// censorship event is declared and the block source is changed.
	BlockCensorshipTimeoutKey time.Duration
	// The initial value of the actual retry interval, which is increased on every failed retry
	MinimalReconnectInterval time.Duration
	// 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 GossipBlockHandler

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

func (*GossipBlockHandler) HandleBlock

func (h *GossipBlockHandler) HandleBlock(channelID string, block *common.Block) error

type GossipServiceAdapter

type GossipServiceAdapter interface {
	// AddPayload adds payload to the local state sync buffer
	AddPayload(chainID string, payload *gossip.Payload) error

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

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

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