config

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2017 License: Apache-2.0 Imports: 20 Imported by: 1,070

Documentation

Overview

Note, the directory is still configvalues, but this is stuttery and config is a more accurate and better name, TODO, update directory

Index

Constants

View Source
const (
	// ConsortiumKey is the key for the cb.ConfigValue for the Consortium message
	ConsortiumKey = "Consortium"

	// HashingAlgorithmKey is the cb.ConfigItem type key name for the HashingAlgorithm message
	HashingAlgorithmKey = "HashingAlgorithm"

	// BlockDataHashingStructureKey is the cb.ConfigItem type key name for the BlockDataHashingStructure message
	BlockDataHashingStructureKey = "BlockDataHashingStructure"

	// OrdererAddressesKey is the cb.ConfigItem type key name for the OrdererAddresses message
	OrdererAddressesKey = "OrdererAddresses"

	// GroupKey is the name of the channel group
	ChannelGroupKey = "Channel"
)

Channel config keys

View Source
const (
	// ConsensusTypeKey is the cb.ConfigItem type key name for the ConsensusType message
	ConsensusTypeKey = "ConsensusType"

	// BatchSizeKey is the cb.ConfigItem type key name for the BatchSize message
	BatchSizeKey = "BatchSize"

	// BatchTimeoutKey is the cb.ConfigItem type key name for the BatchTimeout message
	BatchTimeoutKey = "BatchTimeout"

	// ChannelRestrictions is the key name for the ChannelRestrictions message
	ChannelRestrictionsKey = "ChannelRestrictions"

	// KafkaBrokersKey is the cb.ConfigItem type key name for the KafkaBrokers message
	KafkaBrokersKey = "KafkaBrokers"
)
View Source
const (
	// AnchorPeersKey is the key name for the AnchorPeers ConfigValue
	AnchorPeersKey = "AnchorPeers"
)

Application org config keys

View Source
const (
	// ApplicationGroupKey is the group name for the Application config
	ApplicationGroupKey = "Application"
)
View Source
const (
	// ChannelCreationPolicyKey is the key for the ChannelCreationPolicy value
	ChannelCreationPolicyKey = "ChannelCreationPolicy"
)
View Source
const (
	// ConsortiumsGroupKey is the group name for the consortiums config
	ConsortiumsGroupKey = "Consortiums"
)
View Source
const (
	// MSPKey is value key for marshaled *mspconfig.MSPConfig
	MSPKey = "MSP"
)

Org config keys

View Source
const (
	// OrdererGroupKey is the group name for the orderer config
	OrdererGroupKey = "Orderer"
)

Variables

This section is empty.

Functions

func DefaultBlockDataHashingStructure

func DefaultBlockDataHashingStructure() *cb.ConfigGroup

DefaultBlockDatahashingStructure creates a headerless config item for the default block data hashing structure

func DefaultHashingAlgorithm

func DefaultHashingAlgorithm() *cb.ConfigGroup

DefaultHashingAlgorithm creates a headerless config item for the default hashing algorithm

func DefaultOrdererAddresses

func DefaultOrdererAddresses() *cb.ConfigGroup

DefaultOrdererAddresses creates a headerless config item for the default orderer addresses

func NewStandardValues

func NewStandardValues(protosStructs ...interface{}) (*standardValues, error)

NewStandardValues accepts a structure which must contain only protobuf message types. The structure may embed other (non-pointer) structures which satisfy the same condition. NewStandard values will instantiate memory for all the proto messages and build a lookup map from structure field name to proto message instance This is a useful way to easily implement the Values interface

func TemplateAnchorPeers

func TemplateAnchorPeers(orgID string, anchorPeers []*pb.AnchorPeer) *cb.ConfigGroup

TemplateAnchorPeers creates a headerless config item representing the anchor peers

func TemplateBatchSize

func TemplateBatchSize(batchSize *ab.BatchSize) *cb.ConfigGroup

TemplateBatchSize creates a headerless config item representing the batch size

func TemplateBatchTimeout

func TemplateBatchTimeout(batchTimeout string) *cb.ConfigGroup

TemplateBatchTimeout creates a headerless config item representing the batch timeout

func TemplateBlockDataHashingStructure

func TemplateBlockDataHashingStructure(width uint32) *cb.ConfigGroup

TemplateBlockDataHashingStructure creates a headerless config item representing the block data hashing structure

func TemplateChannelRestrictions

func TemplateChannelRestrictions(maxChannels uint64) *cb.ConfigGroup

TemplateChannelRestrictions creates a config group with ChannelRestrictions specified

func TemplateConsensusType

func TemplateConsensusType(typeValue string) *cb.ConfigGroup

TemplateConsensusType creates a headerless config item representing the consensus type

func TemplateConsortium

func TemplateConsortium(name string) *cb.ConfigGroup

TemplateConsortiumName creates a ConfigGroup representing the ConsortiumName

func TemplateConsortiumChannelCreationPolicy

func TemplateConsortiumChannelCreationPolicy(name string, policy *cb.Policy) *cb.ConfigGroup

TemplateConsortiumChannelCreationPolicy sets the ChannelCreationPolicy for a given consortium

func TemplateConsortiumsGroup

func TemplateConsortiumsGroup() *cb.ConfigGroup

TemplateConsortiumsGroup creates an empty consortiums group

func TemplateHashingAlgorithm

func TemplateHashingAlgorithm(name string) *cb.ConfigGroup

TemplateHashingAlgorithm creates a ConfigGroup representing the HashingAlgorithm

func TemplateKafkaBrokers

func TemplateKafkaBrokers(brokers []string) *cb.ConfigGroup

TemplateKafkaBrokers creates a headerless config item representing the kafka brokers

func TemplateOrdererAddresses

func TemplateOrdererAddresses(addresses []string) *cb.ConfigGroup

TemplateOrdererAddressess creates a headerless config item representing the orderer addresses

Types

type Application

type Application interface {
	// Organizations returns a map of org ID to ApplicationOrg
	Organizations() map[string]ApplicationOrg
}

Application stores the common shared application config

type ApplicationConfig

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

func NewApplicationConfig

func NewApplicationConfig(ag *ApplicationGroup) *ApplicationConfig

func (*ApplicationConfig) Commit

func (ac *ApplicationConfig) Commit()

func (ApplicationConfig) Deserialize

func (sv ApplicationConfig) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ApplicationConfig) Organizations

func (ac *ApplicationConfig) Organizations() map[string]ApplicationOrg

Organizations returns a map of org ID to ApplicationOrg

func (*ApplicationConfig) Validate

func (ac *ApplicationConfig) Validate(tx interface{}, groups map[string]ValueProposer) error

type ApplicationGroup

type ApplicationGroup struct {
	*Proposer
	*ApplicationConfig
	// contains filtered or unexported fields
}

ApplicationGroup represents the application config group

func NewApplicationGroup

func NewApplicationGroup(mspConfig *msp.MSPConfigHandler) *ApplicationGroup

NewSharedConfigImpl creates a new SharedConfigImpl with the given CryptoHelper

func (*ApplicationGroup) Allocate

func (ag *ApplicationGroup) Allocate() Values

Allocate returns a new instance of the ApplicationConfig

func (ApplicationGroup) Deserialize

func (sv ApplicationGroup) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ApplicationGroup) NewGroup

func (ag *ApplicationGroup) NewGroup(name string) (ValueProposer, error)

type ApplicationOrg

type ApplicationOrg interface {
	Org

	// AnchorPeers returns the list of gossip anchor peers
	AnchorPeers() []*pb.AnchorPeer
}

ApplicationOrg stores the per org application config

type ApplicationOrgConfig

type ApplicationOrgConfig struct {
	*OrganizationConfig
	// contains filtered or unexported fields
}

func NewApplicationOrgConfig

func NewApplicationOrgConfig(aog *ApplicationOrgGroup) *ApplicationOrgConfig

func (*ApplicationOrgConfig) AnchorPeers

func (aog *ApplicationOrgConfig) AnchorPeers() []*pb.AnchorPeer

AnchorPeers returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver

func (*ApplicationOrgConfig) Commit

func (aoc *ApplicationOrgConfig) Commit()

func (ApplicationOrgConfig) Deserialize

func (sv ApplicationOrgConfig) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ApplicationOrgConfig) Validate

func (aoc *ApplicationOrgConfig) Validate(tx interface{}, groups map[string]ValueProposer) error

type ApplicationOrgGroup

type ApplicationOrgGroup struct {
	*Proposer
	*OrganizationGroup
	*ApplicationOrgConfig
}

ApplicationOrgGroup defines the configuration for an application org

func NewApplicationOrgGroup

func NewApplicationOrgGroup(id string, mspConfig *mspconfig.MSPConfigHandler) *ApplicationOrgGroup

NewApplicationOrgGroup creates a new ApplicationOrgGroup

func (*ApplicationOrgGroup) Allocate

func (aog *ApplicationOrgGroup) Allocate() Values

type ApplicationOrgProtos

type ApplicationOrgProtos struct {
	AnchorPeers *pb.AnchorPeers
}

type Channel

type Channel interface {
	// HashingAlgorithm returns the default algorithm to be used when hashing
	// such as computing block hashes, and CreationPolicy digests
	HashingAlgorithm() func(input []byte) []byte

	// BlockDataHashingStructureWidth returns the width to use when constructing the
	// Merkle tree to compute the BlockData hash
	BlockDataHashingStructureWidth() uint32

	// OrdererAddresses returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver
	OrdererAddresses() []string
}

Channel gives read only access to the channel configuration

type ChannelConfig

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

ChannelConfig stores the channel configuration

func NewChannelConfig

func NewChannelConfig() *ChannelConfig

NewChannelConfig creates a new ChannelConfig

func (*ChannelConfig) BlockDataHashingStructureWidth

func (cc *ChannelConfig) BlockDataHashingStructureWidth() uint32

BlockDataHashingStructure returns the width to use when forming the block data hashing structure

func (*ChannelConfig) ConsortiumName

func (cc *ChannelConfig) ConsortiumName() string

ConsortiumName returns the name of the consortium this channel was created under

func (ChannelConfig) Deserialize

func (sv ChannelConfig) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ChannelConfig) HashingAlgorithm

func (cc *ChannelConfig) HashingAlgorithm() func(input []byte) []byte

HashingAlgorithm returns a function pointer to the chain hashing algorihtm

func (*ChannelConfig) OrdererAddresses

func (cc *ChannelConfig) OrdererAddresses() []string

OrdererAddresses returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver

func (*ChannelConfig) Validate

func (cc *ChannelConfig) Validate(tx interface{}, groups map[string]ValueProposer) error

Validate inspects the generated configuration protos, ensures that the values are correct, and sets the ChannelConfig fields that may be referenced after Commit

type ChannelGroup

type ChannelGroup struct {
	*ChannelConfig
	*Proposer
	// contains filtered or unexported fields
}

ChannelGroup

func NewChannelGroup

func NewChannelGroup(mspConfigHandler *msp.MSPConfigHandler) *ChannelGroup

func (*ChannelGroup) Allocate

func (cg *ChannelGroup) Allocate() Values

Allocate creates new config resources for a pending config update

func (*ChannelGroup) ApplicationConfig

func (cg *ChannelGroup) ApplicationConfig() *ApplicationGroup

ApplicationConfig returns the application config associated with this channel

func (*ChannelGroup) ConsortiumsConfig

func (cg *ChannelGroup) ConsortiumsConfig() *ConsortiumsGroup

ConsortiumsConfig returns the consortium config associated with this channel if it exists

func (ChannelGroup) Deserialize

func (sv ChannelGroup) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ChannelGroup) NewGroup

func (cg *ChannelGroup) NewGroup(group string) (ValueProposer, error)

NewGroup instantiates either a new application or orderer config

func (*ChannelGroup) OrdererConfig

func (cg *ChannelGroup) OrdererConfig() *OrdererGroup

OrdererConfig returns the orderer config associated with this channel

type ChannelProtos

type ChannelProtos struct {
	HashingAlgorithm          *cb.HashingAlgorithm
	BlockDataHashingStructure *cb.BlockDataHashingStructure
	OrdererAddresses          *cb.OrdererAddresses
	Consortium                *cb.Consortium
}

ChannelProtos is where the proposed configuration is unmarshaled into

type ChannelValues

type ChannelValues interface {
	// HashingAlgorithm returns the default algorithm to be used when hashing
	// such as computing block hashes, and CreationPolicy digests
	HashingAlgorithm() func(input []byte) []byte

	// BlockDataHashingStructureWidth returns the width to use when constructing the
	// Merkle tree to compute the BlockData hash
	BlockDataHashingStructureWidth() uint32

	// OrdererAddresses returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver
	OrdererAddresses() []string
}

ChannelValues gives read only access to the channel configuration

type Consortium

type Consortium interface {
	// ChannelCreationPolicy returns the policy to check when instantiating a channel for this consortium
	ChannelCreationPolicy() *cb.Policy
}

Consortium represents a group of orgs which may create channels together

type ConsortiumConfig

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

ConsortiumConfig holds the consoritums configuration information

func NewConsortiumConfig

func NewConsortiumConfig(cg *ConsortiumGroup) *ConsortiumConfig

NewConsortiumConfig creates a new instance of the consoritums config

func (*ConsortiumConfig) ChannelCreationPolicy

func (cc *ConsortiumConfig) ChannelCreationPolicy() *cb.Policy

CreationPolicy returns the policy structure used to validate the channel creation

func (*ConsortiumConfig) Commit

func (cc *ConsortiumConfig) Commit()

Commit commits the ConsortiumConfig

func (ConsortiumConfig) Deserialize

func (sv ConsortiumConfig) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ConsortiumConfig) Organizations

func (cc *ConsortiumConfig) Organizations() map[string]*OrganizationGroup

Organizations returns the set of organizations in the consortium

func (*ConsortiumConfig) Validate

func (cc *ConsortiumConfig) Validate(tx interface{}, groups map[string]ValueProposer) error

Validate builds the Consortium map

type ConsortiumGroup

type ConsortiumGroup struct {
	*Proposer
	*ConsortiumConfig
	// contains filtered or unexported fields
}

ConsortiumGroup stores the set of Consortium

func NewConsortiumGroup

func NewConsortiumGroup(mspConfig *msp.MSPConfigHandler) *ConsortiumGroup

NewConsortiumGroup creates a new *ConsortiumGroup

func (*ConsortiumGroup) Allocate

func (cg *ConsortiumGroup) Allocate() Values

Allocate returns the resources for a new config proposal

func (*ConsortiumGroup) BeginValueProposals

func (cg *ConsortiumGroup) BeginValueProposals(tx interface{}, groups []string) (ValueDeserializer, []ValueProposer, error)

BeginValueProposals calls through to Proposer after calling into the MSP config Handler

func (*ConsortiumGroup) CommitProposals

func (cg *ConsortiumGroup) CommitProposals(tx interface{})

CommitProposals intercepts the commit request and commits the MSP config handler before calling the underlying proposer

func (ConsortiumGroup) Deserialize

func (sv ConsortiumGroup) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ConsortiumGroup) NewGroup

func (cg *ConsortiumGroup) NewGroup(name string) (ValueProposer, error)

NewGroup returns a Consortium instance

func (*ConsortiumGroup) PreCommit

func (cg *ConsortiumGroup) PreCommit(tx interface{}) error

PreCommit intercepts the precommit request and commits the MSP config handler before calling the underlying proposer

func (*ConsortiumGroup) RollbackProposals

func (cg *ConsortiumGroup) RollbackProposals(tx interface{})

RollbackProposals intercepts the rollback request and commits the MSP config handler before calling the underlying proposer

type ConsortiumProtos

type ConsortiumProtos struct {
	ChannelCreationPolicy *cb.Policy
}

ConsortiumProtos holds the config protos for the consortium config

type Consortiums

type Consortiums interface {
	// Consortiums returns the set of consortiums
	Consortiums() map[string]Consortium
}

Consortiums represents the set of consortiums serviced by an ordering service

type ConsortiumsConfig

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

ConsortiumsConfig holds the consoritums configuration information

func NewConsortiumsConfig

func NewConsortiumsConfig(cg *ConsortiumsGroup) *ConsortiumsConfig

NewConsortiumsConfig creates a new instance of the consoritums config

func (*ConsortiumsConfig) Commit

func (cc *ConsortiumsConfig) Commit()

Commit commits the ConsortiumsConfig

func (*ConsortiumsConfig) Consortiums

func (cc *ConsortiumsConfig) Consortiums() map[string]Consortium

Consortiums returns a map of the current consortiums

func (ConsortiumsConfig) Deserialize

func (sv ConsortiumsConfig) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ConsortiumsConfig) Validate

func (cc *ConsortiumsConfig) Validate(tx interface{}, groups map[string]ValueProposer) error

Validate builds the Consortiums map

type ConsortiumsGroup

type ConsortiumsGroup struct {
	*Proposer
	*ConsortiumsConfig
	// contains filtered or unexported fields
}

ConsortiumsGroup stores the set of Consortiums

func NewConsortiumsGroup

func NewConsortiumsGroup(mspConfig *msp.MSPConfigHandler) *ConsortiumsGroup

NewConsortiumsGroup creates a new *ConsortiumsGroup

func (*ConsortiumsGroup) Allocate

func (cg *ConsortiumsGroup) Allocate() Values

Allocate returns the resources for a new config proposal

func (ConsortiumsGroup) Deserialize

func (sv ConsortiumsGroup) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*ConsortiumsGroup) NewGroup

func (cg *ConsortiumsGroup) NewGroup(name string) (ValueProposer, error)

NewGroup returns a Consortium instance

type Handler

type Handler interface {
	Allocate() Values
	NewGroup(name string) (ValueProposer, error)
}

Handler

type Orderer

type Orderer interface {
	// ConsensusType returns the configured consensus type
	ConsensusType() string

	// BatchSize returns the maximum number of messages to include in a block
	BatchSize() *ab.BatchSize

	// BatchTimeout returns the amount of time to wait before creating a batch
	BatchTimeout() time.Duration

	// MaxChannelsCount returns the maximum count of channels to allow for an ordering network
	MaxChannelsCount() uint64

	// KafkaBrokers returns the addresses (IP:port notation) of a set of "bootstrap"
	// Kafka brokers, i.e. this is not necessarily the entire set of Kafka brokers
	// used for ordering
	KafkaBrokers() []string

	// Organizations returns the organizations for the ordering service
	Organizations() map[string]Org
}

Orderer stores the common shared orderer config

type OrdererConfig

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

OrdererConfig holds the orderer configuration information

func NewOrdererConfig

func NewOrdererConfig(og *OrdererGroup) *OrdererConfig

NewOrdererConfig creates a new instance of the orderer config

func (*OrdererConfig) BatchSize

func (oc *OrdererConfig) BatchSize() *ab.BatchSize

BatchSize returns the maximum number of messages to include in a block

func (*OrdererConfig) BatchTimeout

func (oc *OrdererConfig) BatchTimeout() time.Duration

BatchTimeout returns the amount of time to wait before creating a batch

func (*OrdererConfig) Commit

func (oc *OrdererConfig) Commit()

Commit writes the orderer config back to the orderer config group

func (*OrdererConfig) ConsensusType

func (oc *OrdererConfig) ConsensusType() string

ConsensusType returns the configured consensus type

func (OrdererConfig) Deserialize

func (sv OrdererConfig) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*OrdererConfig) KafkaBrokers

func (oc *OrdererConfig) KafkaBrokers() []string

KafkaBrokers returns the addresses (IP:port notation) of a set of "bootstrap" Kafka brokers, i.e. this is not necessarily the entire set of Kafka brokers used for ordering

func (*OrdererConfig) MaxChannelsCount

func (oc *OrdererConfig) MaxChannelsCount() uint64

MaxChannelsCount returns the maximum count of channels this orderer supports

func (*OrdererConfig) Organizations

func (oc *OrdererConfig) Organizations() map[string]Org

Organizations returns a map of the orgs in the channel

func (*OrdererConfig) Validate

func (oc *OrdererConfig) Validate(tx interface{}, groups map[string]ValueProposer) error

type OrdererGroup

type OrdererGroup struct {
	*Proposer
	*OrdererConfig
	// contains filtered or unexported fields
}

Config is stores the orderer component configuration

func NewOrdererGroup

func NewOrdererGroup(mspConfig *msp.MSPConfigHandler) *OrdererGroup

NewConfig creates a new *OrdererConfig

func (*OrdererGroup) Allocate

func (og *OrdererGroup) Allocate() Values

func (OrdererGroup) Deserialize

func (sv OrdererGroup) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*OrdererGroup) NewGroup

func (og *OrdererGroup) NewGroup(name string) (ValueProposer, error)

NewGroup returns an Org instance

type OrdererProtos

type OrdererProtos struct {
	ConsensusType       *ab.ConsensusType
	BatchSize           *ab.BatchSize
	BatchTimeout        *ab.BatchTimeout
	KafkaBrokers        *ab.KafkaBrokers
	ChannelRestrictions *ab.ChannelRestrictions
}

OrdererProtos is used as the source of the OrdererConfig

type Org

type Org interface {
	// Name returns the name this org is referred to in config
	Name() string

	// MSPID returns the MSP ID associated with this org
	MSPID() string
}

Org stores the common organizational config

type OrganizationConfig

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

func NewOrganizationConfig

func NewOrganizationConfig(og *OrganizationGroup) *OrganizationConfig

func (*OrganizationConfig) Commit

func (oc *OrganizationConfig) Commit()

func (OrganizationConfig) Deserialize

func (sv OrganizationConfig) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*OrganizationConfig) Validate

func (oc *OrganizationConfig) Validate(tx interface{}, groups map[string]ValueProposer) error

Validate returns whether the configuration is valid

type OrganizationGroup

type OrganizationGroup struct {
	*Proposer
	*OrganizationConfig
	// contains filtered or unexported fields
}

Config stores common configuration information for organizations

func NewOrganizationGroup

func NewOrganizationGroup(name string, mspConfigHandler *mspconfig.MSPConfigHandler) *OrganizationGroup

NewConfig creates an instnace of the organization Config

func (*OrganizationGroup) Allocate

func (og *OrganizationGroup) Allocate() Values

Allocate creates the proto resources neeeded for a proposal

func (OrganizationGroup) Deserialize

func (sv OrganizationGroup) Deserialize(key string, value []byte) (proto.Message, error)

Deserialize looks up the backing Values proto of the given name, unmarshals the given bytes to populate the backing message structure, and returns a referenced to the retained deserialized message (or an error, either because the key did not exist, or there was an an error unmarshaling

func (*OrganizationGroup) MSPID

func (og *OrganizationGroup) MSPID() string

MSPID returns the MSP ID associated with this org

func (*OrganizationGroup) Name

func (og *OrganizationGroup) Name() string

Name returns the name this org is referred to in config

func (*OrganizationGroup) NewGroup

func (og *OrganizationGroup) NewGroup(name string) (ValueProposer, error)

NewGroup always errors

type OrganizationProtos

type OrganizationProtos struct {
	MSP *mspprotos.MSPConfig
}

type Proposer

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

func NewProposer

func NewProposer(vh Handler) *Proposer

func (*Proposer) BeginValueProposals

func (p *Proposer) BeginValueProposals(tx interface{}, groups []string) (ValueDeserializer, []ValueProposer, error)

BeginValueProposals called when a config proposal is begun

func (*Proposer) CommitProposals

func (p *Proposer) CommitProposals(tx interface{})

CommitProposals called when a config proposal is committed

func (*Proposer) PreCommit

func (p *Proposer) PreCommit(tx interface{}) error

Validate ensures that the new config values is a valid change

func (*Proposer) RollbackProposals

func (p *Proposer) RollbackProposals(tx interface{})

RollbackProposals called when a config proposal is abandoned

type Root

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

Root acts as the object which anchors the rest of the config Note, yes, this is a stuttering name, but, the intent is to move this up one level at the end of refactoring

func NewRoot

func NewRoot(mspConfigHandler *msp.MSPConfigHandler) *Root

NewRoot creates a new instance of the Root

func (*Root) Application

func (r *Root) Application() *ApplicationGroup

Application returns the associated Application level config

func (*Root) BeginValueProposals

func (r *Root) BeginValueProposals(tx interface{}, groups []string) (ValueDeserializer, []ValueProposer, error)

BeginValueProposals is used to start a new config proposal

func (*Root) Channel

func (r *Root) Channel() *ChannelGroup

Channel returns the associated Channel level config

func (*Root) CommitProposals

func (r *Root) CommitProposals(tx interface{})

CommitConfig is used to commit a new config proposal

func (*Root) Consortiums

func (r *Root) Consortiums() *ConsortiumsGroup

func (*Root) Orderer

func (r *Root) Orderer() *OrdererGroup

Orderer returns the associated Orderer level config

func (*Root) PreCommit

func (r *Root) PreCommit(tx interface{}) error

PreCommit is used to verify total configuration before commit

func (*Root) RollbackProposals

func (r *Root) RollbackProposals(tx interface{})

RollbackConfig is used to abandon a new config proposal

type ValueDeserializer

type ValueDeserializer interface {
	// Deserialize takes a Value key as a string, and a marshaled Value value as bytes
	// and returns the deserialized version of that value.  Note, this function operates
	// with side effects intended.  Using a ValueDeserializer to deserialize a message will
	// generally set the value in the Values interface that the ValueDeserializer derived from
	// Therefore, the proto.Message may be safely discarded, but may be retained for
	// inspection and or debugging purposes.
	Deserialize(key string, value []byte) (proto.Message, error)
}

ValueDeserializer provides a mechanism to retrieve proto messages to deserialize config values into

type ValueProposer

type ValueProposer interface {
	// BeginValueProposals called when a config proposal is begun
	BeginValueProposals(tx interface{}, groups []string) (ValueDeserializer, []ValueProposer, error)

	// RollbackProposals called when a config proposal is abandoned
	RollbackProposals(tx interface{})

	// PreCommit is invoked before committing the config to catch
	// any errors which cannot be caught on a per proposal basis
	// TODO, rename other methods to remove Value/Proposal references
	PreCommit(tx interface{}) error

	// CommitProposals called when a config proposal is committed
	CommitProposals(tx interface{})
}

type Values

type Values interface {
	ValueDeserializer

	// Validate should ensure that the values set into the proto messages are correct
	// and that the new group values are allowed.  It also includes a tx ID in case cross
	// Handler invocations (ie to the MSP Config Manager) must be made
	Validate(interface{}, map[string]ValueProposer) error

	// Commit should call back into the Value handler to update the config
	Commit()
}

Values defines a mechanism to supply messages to unamrshal from config and a mechanism to validate the results

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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