multichannel

package
v2.0.0-beta+incompatible Latest Latest
Warning

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

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

Documentation

Overview

Package multichannel tracks the channel resources for the orderer. It initially loads the set of existing channels, and provides an interface for users of these channels to retrieve them, or create new ones.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigBlock added in v1.4.1

func ConfigBlock(reader blockledger.Reader) *cb.Block

ConfigBlock retrieves the last configuration block from the given ledger. Panics on failure.

Types

type BlockWriter

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

BlockWriter efficiently writes the blockchain to disk. To safely use BlockWriter, only one thread should interact with it. BlockWriter will spawn additional committing go routines and handle locking so that these other go routines safely interact with the calling one.

func (*BlockWriter) CreateNextBlock

func (bw *BlockWriter) CreateNextBlock(messages []*cb.Envelope) *cb.Block

CreateNextBlock creates a new block with the next block number, and the given contents.

func (*BlockWriter) WriteBlock

func (bw *BlockWriter) WriteBlock(block *cb.Block, encodedMetadataValue []byte)

WriteBlock should be invoked for blocks which contain normal transactions. It sets the target block as the pending next block, and returns before it is committed. Before returning, it acquires the committing lock, and spawns a go routine which will annotate the block with metadata and signatures, and write the block to the ledger then release the lock. This allows the calling thread to begin assembling the next block before the commit phase is complete.

func (*BlockWriter) WriteConfigBlock

func (bw *BlockWriter) WriteConfigBlock(block *cb.Block, encodedMetadataValue []byte)

WriteConfigBlock should be invoked for blocks which contain a config transaction. This call will block until the new config has taken effect, then will return while the block is written asynchronously to disk.

type ChainSupport

type ChainSupport struct {
	msgprocessor.Processor
	*BlockWriter
	consensus.Chain

	identity.SignerSerializer
	BCCSP bccsp.BCCSP

	// NOTE: It makes sense to add this to the ChainSupport since the design of Registrar does not assume
	// that there is a single consensus type at this orderer node and therefore the resolution of
	// the consensus type too happens only at the ChainSupport level.
	consensus.MetadataValidator
	// contains filtered or unexported fields
}

ChainSupport holds the resources for a particular channel.

func (*ChainSupport) Append added in v1.4.1

func (cs *ChainSupport) Append(block *cb.Block) error

Append appends a new block to the ledger in its raw form, unlike WriteBlock that also mutates its metadata.

func (*ChainSupport) Block added in v1.4.1

func (cs *ChainSupport) Block(number uint64) *cb.Block

Block returns a block with the following number, or nil if such a block doesn't exist.

func (*ChainSupport) BlockCutter

func (cs *ChainSupport) BlockCutter() blockcutter.Receiver

BlockCutter returns the blockcutter.Receiver instance for this channel.

func (*ChainSupport) ChannelID

func (cs *ChainSupport) ChannelID() string

ChannelID passes through to the underlying configtx.Validator

func (*ChainSupport) ConfigProto

func (cs *ChainSupport) ConfigProto() *cb.Config

ConfigProto passes through to the underlying configtx.Validator

func (*ChainSupport) ProposeConfigUpdate

func (cs *ChainSupport) ProposeConfigUpdate(configtx *cb.Envelope) (*cb.ConfigEnvelope, error)

ProposeConfigUpdate validates a config update using the underlying configtx.Validator and the consensus.MetadataValidator.

func (*ChainSupport) Reader

func (cs *ChainSupport) Reader() blockledger.Reader

func (*ChainSupport) Sequence

func (cs *ChainSupport) Sequence() uint64

Sequence passes through to the underlying configtx.Validator

func (*ChainSupport) Signer

func (cs *ChainSupport) Signer() identity.SignerSerializer

Signer returns the SignerSerializer for this channel.

func (*ChainSupport) Validate

func (cs *ChainSupport) Validate(configEnv *cb.ConfigEnvelope) error

Validate passes through to the underlying configtx.Validator

func (*ChainSupport) VerifyBlockSignature added in v1.4.1

func (cs *ChainSupport) VerifyBlockSignature(sd []*protoutil.SignedData, envelope *cb.ConfigEnvelope) error

VerifyBlockSignature verifies a signature of a block. It has an optional argument of a configuration envelope which would make the block verification to use validation rules based on the given configuration in the ConfigEnvelope. If the config envelope passed is nil, then the validation rules used are the ones that were applied at commit of previous blocks.

type Registrar

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

Registrar serves as a point of access and control for the individual channel resources.

func NewRegistrar

func NewRegistrar(
	config localconfig.TopLevel,
	ledgerFactory blockledger.Factory,
	signer identity.SignerSerializer,
	metricsProvider metrics.Provider,
	bccsp bccsp.BCCSP,
	callbacks ...channelconfig.BundleActor,
) *Registrar

NewRegistrar produces an instance of a *Registrar.

func (*Registrar) BroadcastChannelSupport

func (r *Registrar) BroadcastChannelSupport(msg *cb.Envelope) (*cb.ChannelHeader, bool, *ChainSupport, error)

BroadcastChannelSupport returns the message channel header, whether the message is a config update and the channel resources for a message or an error if the message is not a message which can be processed directly (like CONFIG and ORDERER_TRANSACTION messages)

func (*Registrar) ChannelsCount

func (r *Registrar) ChannelsCount() int

ChannelsCount returns the count of the current total number of channels.

func (*Registrar) CreateBundle

func (r *Registrar) CreateBundle(channelID string, config *cb.Config) (channelconfig.Resources, error)

CreateBundle calls channelconfig.NewBundle

func (*Registrar) CreateChain added in v1.4.1

func (r *Registrar) CreateChain(chainName string)

CreateChain makes the Registrar create a chain with the given name.

func (*Registrar) GetChain

func (r *Registrar) GetChain(chainID string) *ChainSupport

GetChain retrieves the chain support for a chain if it exists.

func (*Registrar) Initialize added in v1.4.1

func (r *Registrar) Initialize(consenters map[string]consensus.Consenter)

func (*Registrar) NewChannelConfig

func (r *Registrar) NewChannelConfig(envConfigUpdate *cb.Envelope) (channelconfig.Resources, error)

NewChannelConfig produces a new template channel configuration based on the system channel's current config.

func (*Registrar) SystemChannelID

func (r *Registrar) SystemChannelID() string

SystemChannelID returns the ChannelID for the system channel.

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