configtx

package
v1.0.0-preview Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: Apache-2.0 Imports: 15 Imported by: 3,201

Documentation

Index

Constants

View Source
const (
	CreationPolicyKey = "CreationPolicy"
)
View Source
const NewConfigurationItemPolicyKey = "NewConfigurationItemPolicy"

NewConfigurationItemPolicyKey is the ID of the policy used when no other policy can be resolved, for instance when attempting to create a new config item

Variables

This section is empty.

Functions

func HashItems

func HashItems(items []*cb.SignedConfigurationItem, hash func([]byte) []byte) []byte

HashItems is a utility method for computing the hash of the concatenation of the marshaled ConfigurationItems in a []*cb.SignedConfigurationItem

func MakeChainCreationTransaction

func MakeChainCreationTransaction(creationPolicy string, chainID string, signer msp.SigningIdentity, templates ...Template) (*cb.Envelope, error)

MakeChainCreationTransaction is a handy utility function for creating new chain transactions using the underlying Template framework

func NewFilter

func NewFilter(manager Manager) filter.Rule

New creates a new configfilter Rule based on the given Manager

Types

type BytesHandler

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

BytesHandler is a trivial ConfigHandler which simply tracks the bytes stores in a config

func NewBytesHandler

func NewBytesHandler() *BytesHandler

NewBytesHandler creates a new BytesHandler

func (*BytesHandler) BeginConfig

func (bh *BytesHandler) BeginConfig()

BeginConfig called when a config proposal is begun

func (*BytesHandler) CommitConfig

func (bh *BytesHandler) CommitConfig()

CommitConfig called when a config proposal is committed

func (*BytesHandler) GetBytes

func (bh *BytesHandler) GetBytes(id string) []byte

GetBytes allows the caller to retrieve the bytes for a config

func (*BytesHandler) ProposeConfig

func (bh *BytesHandler) ProposeConfig(configItem *cb.ConfigurationItem) error

ProposeConfig called when config is added to a proposal

func (*BytesHandler) RollbackConfig

func (bh *BytesHandler) RollbackConfig()

RollbackConfig called when a config proposal is abandoned

type Handler

type Handler interface {
	// BeginConfig called when a config proposal is begun
	BeginConfig()

	// RollbackConfig called when a config proposal is abandoned
	RollbackConfig()

	// CommitConfig called when a config proposal is committed
	CommitConfig()

	// ProposeConfig called when config is added to a proposal
	ProposeConfig(configItem *cb.ConfigurationItem) error
}

Handler provides a hook which allows other pieces of code to participate in config proposals

type Initializer

type Initializer interface {
	Resources
	// Handlers returns the handlers to be used when initializing the configtx.Manager
	Handlers() map[cb.ConfigurationItem_ConfigurationType]Handler
}

Initializer is a structure which is only useful before a configtx.Manager has been instantiated for a chain, afterwards, it is of no utility, which is why it embeds the Resources interface

func NewInitializer

func NewInitializer() Initializer

NewInitializer creates a chain initializer for the basic set of common chain resources

type Manager

type Manager interface {
	Resources

	// Apply attempts to apply a configtx to become the new configuration
	Apply(configtx *cb.ConfigurationEnvelope) error

	// Validate attempts to validate a new configtx against the current config state
	Validate(configtx *cb.ConfigurationEnvelope) error

	// ChainID retrieves the chain ID associated with this manager
	ChainID() string

	// Sequence returns the current sequence number of the configuration
	Sequence() uint64
}

Manager provides a mechanism to query and update configuration

func NewManagerImpl

func NewManagerImpl(configtx *cb.ConfigurationEnvelope, initializer Initializer, callOnUpdate []func(Manager)) (Manager, error)

NewManagerImpl creates a new Manager unless an error is encountered, each element of the callOnUpdate slice is invoked when a new configuration is committed

type Resources

type Resources interface {
	// PolicyManager returns the policies.Manager for the chain
	PolicyManager() policies.Manager

	// ChainConfig returns the chainconfig.Descriptor for the chain
	ChainConfig() chainconfig.Descriptor

	// MSPManager returns the msp.MSPManager for the chain
	MSPManager() msp.MSPManager
}

Resources is the common set of configuration resources for all chains Depending on whether chain is used at the orderer or at the peer, other configuration resources may be available

type Template

type Template interface {
	// Items returns a set of SignedConfigurationItems for the given chainID
	Items(chainID string) ([]*cb.SignedConfigurationItem, error)
}

Template can be used to faciliate creation of configuration transactions

func NewChainCreationTemplate

func NewChainCreationTemplate(creationPolicy string, hash func([]byte) []byte, template Template) Template

NewChainCreationTemplate takes a CreationPolicy and a Template to produce a Template which outputs an appropriately constructed list of SignedConfigurationItem including an appropriate digest. Note, using this Template in a CompositeTemplate will invalidate the CreationPolicy

func NewCompositeTemplate

func NewCompositeTemplate(templates ...Template) Template

NewSimpleTemplate creates a Template using the source Templates

func NewSimpleTemplate

func NewSimpleTemplate(items ...*cb.ConfigurationItem) Template

NewSimpleTemplate creates a Template using the supplied items

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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