Documentation ¶
Index ¶
- Variables
- type BlockPullerCreator
- func (creator *BlockPullerCreator) BlockPuller(configBlock *common.Block, stopChannel chan struct{}) (ChannelPuller, error)
- func (creator *BlockPullerCreator) UpdateVerifierFromConfigBlock(configBlock *common.Block) error
- func (creator *BlockPullerCreator) VerifyBlockSequence(blocks []*common.Block, _ string) error
- type BlockPullerFactory
- type Chain
- type ChainCreator
- type ChannelParticipationMetricsReporter
- type ChannelPuller
- type ClusterVerifyBlocksFunc
- type LedgerResources
- type Options
- type TimeAfter
Constants ¶
This section is empty.
Variables ¶
var ErrChainStopped = errors.New("chain stopped")
ErrChainStopped is returned when the chain is stopped during execution.
Functions ¶
This section is empty.
Types ¶
type BlockPullerCreator ¶
type BlockPullerCreator struct { ClusterVerifyBlocks ClusterVerifyBlocksFunc // Default: cluster.VerifyBlocks, or a mock for testing // contains filtered or unexported fields }
BlockPullerCreator creates a ChannelPuller on demand. It also maintains a link to a block signature verifier, and exposes a method to update it on incoming config blocks. The ChannelPuller generated by this factory always accesses the updated verifier, since it is generated with a link to the factory's VerifyBlockSequence method.
func NewBlockPullerCreator ¶
func NewBlockPullerCreator( channelID string, logger *flogging.FabricLogger, signer identity.SignerSerializer, baseDialer *cluster.PredicateDialer, clusterConfig localconfig.Cluster, bccsp bccsp.BCCSP, ) (*BlockPullerCreator, error)
NewBlockPullerCreator creates a new BlockPullerCreator, using the configuration details that do not change during the life cycle of the orderer.
func (*BlockPullerCreator) BlockPuller ¶
func (creator *BlockPullerCreator) BlockPuller(configBlock *common.Block, stopChannel chan struct{}) (ChannelPuller, error)
BlockPuller creates a block puller on demand, taking the endpoints from the config block.
func (*BlockPullerCreator) UpdateVerifierFromConfigBlock ¶
func (creator *BlockPullerCreator) UpdateVerifierFromConfigBlock(configBlock *common.Block) error
UpdateVerifierFromConfigBlock creates a new block signature verifier from the config block and updates the internal link to said verifier.
func (*BlockPullerCreator) VerifyBlockSequence ¶
func (creator *BlockPullerCreator) VerifyBlockSequence(blocks []*common.Block, _ string) error
VerifyBlockSequence verifies a sequence of blocks, using the internal block signature verifier. It also bootstraps the block sig verifier form the genesis block if it does not exist, and skips verifying the genesis block.
type BlockPullerFactory ¶
type BlockPullerFactory interface { BlockPuller(configBlock *common.Block, stopChannel chan struct{}) (ChannelPuller, error) UpdateVerifierFromConfigBlock(configBlock *common.Block) error }
BlockPullerFactory creates a ChannelPuller on demand, and exposes a method to update the a block signature verifier linked to that ChannelPuller.
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain implements a component that allows the orderer to follow a specific channel when is not a cluster member, that is, be a "follower" of the cluster. It also allows the orderer to perform "onboarding" for channels it is joining as a member, with a join-block.
When an orderer is following a channel, it means that the current orderer is not a member of the consenters set of the channel, and is only pulling blocks from other orderers. In this mode, the follower is inspecting config blocks as they are pulled and if it discovers that it was introduced into the consenters set, it will trigger the creation of a regular etcdraft.Chain, that is, turn into a "member" of the cluster.
A follower is also used to onboard a channel when joining as a member with a join-block that has number >0. In this mode the follower will pull blocks up until join-block.number, and then will trigger the creation of a regular etcdraft.Chain.
The follower is started in one of two ways: 1) following an API Join request with a join-block that has block number >0, or 2) when the orderer was a cluster member (i.e. was running a etcdraft.Chain) and was removed from the consenters set.
The follower is in status "onboarding" when it pulls blocks below the join-block number, or "active" when it pulls blocks equal or above the join-block number.
The follower return clusterRelation "member" when the join-block indicates the orderer is in the consenters set, i.e. the follower is performing onboarding for an etcdraft.Chain. Otherwise, the follower return clusterRelation "follower".
func NewChain ¶
func NewChain( ledgerResources LedgerResources, clusterConsenter consensus.ClusterConsenter, joinBlock *common.Block, options Options, blockPullerFactory BlockPullerFactory, chainCreator ChainCreator, cryptoProvider bccsp.BCCSP, channelParticipationMetricsReporter ChannelParticipationMetricsReporter, ) (*Chain, error)
NewChain constructs a follower.Chain object.
func (*Chain) Halt ¶
func (c *Chain) Halt()
Halt signals the Chain to stop and waits for the internal go-routine to exit.
func (*Chain) StatusReport ¶
func (c *Chain) StatusReport() (types.ConsensusRelation, types.Status)
StatusReport returns the ConsensusRelation & Status.
type ChainCreator ¶
type ChainCreator interface {
SwitchFollowerToChain(chainName string)
}
ChainCreator defines a function that creates a new consensus.Chain for this channel, to replace the current follower.Chain. This interface is meant to be implemented by the multichannel.Registrar.
type ChannelParticipationMetricsReporter ¶
type ChannelParticipationMetricsReporter interface {
ReportConsensusRelationAndStatusMetrics(channelID string, relation types.ConsensusRelation, status types.Status)
}
type ChannelPuller ¶
type ChannelPuller interface { PullBlock(seq uint64) *common.Block HeightsByEndpoints() (map[string]uint64, error) UpdateEndpoints(endpoints []cluster.EndpointCriteria) Close() }
ChannelPuller pulls blocks for a channel
type ClusterVerifyBlocksFunc ¶
type ClusterVerifyBlocksFunc func(blockBuff []*common.Block, signatureVerifier cluster.BlockVerifier) error
ClusterVerifyBlocksFunc is a function that matches the signature of cluster.VerifyBlocks, and allows mocks for testing.
type LedgerResources ¶
type LedgerResources interface { // ChannelID The channel ID. ChannelID() string // Block returns a block with the given number, // or nil if such a block doesn't exist. Block(number uint64) *common.Block // Height returns the number of blocks in the chain this channel is associated with. Height() uint64 // Append appends a new block to the ledger in its raw form. Append(block *common.Block) error }
LedgerResources defines some of the interfaces of ledger & config resources needed by the follower.Chain.
type Options ¶
type Options struct { Logger *flogging.FabricLogger PullRetryMinInterval time.Duration PullRetryMaxInterval time.Duration HeightPollMinInterval time.Duration HeightPollMaxInterval time.Duration Cert []byte TimeAfter TimeAfter // If nil, time.After is selected }
Options contains some configuration options relevant to the follower.Chain.