channelconfig

package
v2.0.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApplicationGroupKey is the group name for the Application config
	ApplicationGroupKey = "Application"

	// ACLsKey is the name of the ACLs config
	ACLsKey = "ACLs"
)
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"

	// CapabilitiesKey is the name of the key which refers to capabilities, it appears at the channel,
	// application, and orderer levels and this constant is used for all three.
	CapabilitiesKey = "Capabilities"
)

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"

	// ChannelRestrictionsKey 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 (
	// ReadersPolicyKey is the key used for the read policy
	ReadersPolicyKey = "Readers"

	// WritersPolicyKey is the key used for the read policy
	WritersPolicyKey = "Writers"

	// AdminsPolicyKey is the key used for the read policy
	AdminsPolicyKey = "Admins"
)
View Source
const (
	// AnchorPeersKey is the key name for the AnchorPeers ConfigValue
	AnchorPeersKey = "AnchorPeers"
)
View Source
const (
	// ChannelCreationPolicyKey is the key used in the consortium config to denote the policy
	// to be used in evaluating whether a channel creation request is authorized
	ChannelCreationPolicyKey = "ChannelCreationPolicy"
)
View Source
const (
	// ConsortiumsGroupKey is the group name for the consortiums config
	ConsortiumsGroupKey = "Consortiums"
)
View Source
const (
	// MSPKey is the key for the MSP definition in orderer groups
	MSPKey = "MSP"
)
View Source
const (
	// OrdererGroupKey is the group name for the orderer config.
	OrdererGroupKey = "Orderer"
)
View Source
const RootGroupKey = "Channel"

RootGroupKey is the key for namespacing the channel config, especially for policy evaluation.

Variables

This section is empty.

Functions

func DeserializeProtoValuesFromGroup

func DeserializeProtoValuesFromGroup(group *cb.ConfigGroup, protosStructs ...interface{}) error

DeserializeGroup deserializes the value for all values in a config group

func LogSanityChecks

func LogSanityChecks(res Resources)

func MarshalEtcdRaftMetadata

func MarshalEtcdRaftMetadata(md *etcdraft.ConfigMetadata) ([]byte, error)

MarshalEtcdRaftMetadata serializes etcd RAFT metadata.

func ValidateCapabilities

func ValidateCapabilities(block *cb.Block) error

ValidateCapabilities validates whether the peer can meet the capabilities requirement in the given config block

Types

type Application

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

	// APIPolicyMapper returns a PolicyMapper that maps API names to policies
	APIPolicyMapper() PolicyMapper

	// Capabilities defines the capabilities for the application portion of a channel
	Capabilities() ApplicationCapabilities
}

Application stores the common shared application config

type ApplicationCapabilities

type ApplicationCapabilities interface {
	// Supported returns an error if there are unknown capabilities in this channel which are required
	Supported() error

	// ForbidDuplicateTXIdInBlock specifies whether two transactions with the same TXId are permitted
	// in the same block or whether we mark the second one as TxValidationCode_DUPLICATE_TXID
	ForbidDuplicateTXIdInBlock() bool

	// ACLs returns true is ACLs may be specified in the Application portion of the config tree
	ACLs() bool

	// PrivateChannelData returns true if support for private channel data (a.k.a. collections) is enabled.
	// In v1.1, the private channel data is experimental and has to be enabled explicitly.
	// In v1.2, the private channel data is enabled by default.
	PrivateChannelData() bool

	// CollectionUpgrade returns true if this channel is configured to allow updates to
	// existing collection or add new collections through chaincode upgrade (as introduced in v1.2)
	CollectionUpgrade() bool

	// V1_1Validation returns true is this channel is configured to perform stricter validation
	// of transactions (as introduced in v1.1).
	V1_1Validation() bool

	// V1_2Validation returns true is this channel is configured to perform stricter validation
	// of transactions (as introduced in v1.2).
	V1_2Validation() bool

	// V1_3Validation returns true if this channel supports transaction validation
	// as introduced in v1.3. This includes:
	//  - policies expressible at a ledger key granularity, as described in FAB-8812
	//  - new chaincode lifecycle, as described in FAB-11237
	V1_3Validation() bool

	// V2_0Validation returns true if this channel supports transaction validation
	// as introduced in v2.0. This includes:
	//  - new chaincode lifecycle
	//  - implicit per-org collections
	V2_0Validation() bool

	// LifecycleV20 indicates whether the peer should use the deprecated and problematic
	// v1.x lifecycle, or whether it should use the newer per channel approve/commit definitions
	// process introduced in v2.0.  Note, this should only be used on the endorsing side
	// of peer processing, so that we may safely remove all checks against it in v2.1.
	LifecycleV20() bool

	// MetadataLifecycle always returns false
	MetadataLifecycle() bool

	// KeyLevelEndorsement returns true if this channel supports endorsement
	// policies expressible at a ledger key granularity, as described in FAB-8812
	KeyLevelEndorsement() bool

	// FabToken returns true if this channel supports FabToken functions
	FabToken() bool
}

ApplicationCapabilities defines the capabilities for the application portion of a channel

type ApplicationConfig

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

ApplicationConfig implements the Application interface

func NewApplicationConfig

func NewApplicationConfig(appGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ApplicationConfig, error)

NewApplicationConfig creates config from an Application config group

func (*ApplicationConfig) APIPolicyMapper added in v1.2.0

func (ac *ApplicationConfig) APIPolicyMapper() PolicyMapper

APIPolicyMapper returns a PolicyMapper that maps API names to policies

func (*ApplicationConfig) Capabilities

func (ac *ApplicationConfig) Capabilities() ApplicationCapabilities

Capabilities returns a map of capability name to Capability

func (*ApplicationConfig) Organizations

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

Organizations returns a map of org ID to ApplicationOrg

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
}

ApplicationOrgConfig defines the configuration for an application org

func NewApplicationOrgConfig

func NewApplicationOrgConfig(id string, orgGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ApplicationOrgConfig, error)

NewApplicationOrgConfig creates a new config for an application org

func (*ApplicationOrgConfig) AnchorPeers

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

AnchorPeers returns the list of anchor peers of this Organization

func (*ApplicationOrgConfig) Validate

func (aoc *ApplicationOrgConfig) Validate() error

type ApplicationOrgProtos

type ApplicationOrgProtos struct {
	AnchorPeers *pb.AnchorPeers
}

ApplicationOrgProtos are deserialized from the config

type ApplicationProtos

type ApplicationProtos struct {
	ACLs         *pb.ACLs
	Capabilities *cb.Capabilities
}

ApplicationProtos is used as the source of the ApplicationConfig

type Bundle

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

Bundle is a collection of resources which will always have a consistent view of the channel configuration. In particular, for a given bundle reference, the config sequence, the policy manager etc. will always return exactly the same value. The Bundle structure is immutable and will always be replaced in its entirety, with new backing memory.

func NewBundle

func NewBundle(channelID string, config *cb.Config) (*Bundle, error)

NewBundle creates a new immutable bundle of configuration

func NewBundleFromEnvelope

func NewBundleFromEnvelope(env *cb.Envelope) (*Bundle, error)

NewBundleFromEnvelope wraps the NewBundle function, extracting the needed information from a full configtx

func (*Bundle) ApplicationConfig

func (b *Bundle) ApplicationConfig() (Application, bool)

ApplicationConfig returns the configtxapplication.SharedConfig for the channel and whether the Application config exists.

func (*Bundle) ChannelConfig

func (b *Bundle) ChannelConfig() Channel

ChannelConfig returns the config.Channel for the chain.

func (*Bundle) ConfigtxValidator

func (b *Bundle) ConfigtxValidator() configtx.Validator

ConfigtxValidator returns the configtx.Validator for the channel.

func (*Bundle) ConsortiumsConfig

func (b *Bundle) ConsortiumsConfig() (Consortiums, bool)

ConsortiumsConfig returns the config.Consortiums for the channel and whether the consortiums config exists.

func (*Bundle) MSPManager

func (b *Bundle) MSPManager() msp.MSPManager

MSPManager returns the MSP manager constructed for this config.

func (*Bundle) OrdererConfig

func (b *Bundle) OrdererConfig() (Orderer, bool)

OrdererConfig returns the config.Orderer for the channel and whether the Orderer config exists.

func (*Bundle) PolicyManager

func (b *Bundle) PolicyManager() policies.Manager

PolicyManager returns the policy manager constructed for this config.

func (*Bundle) ValidateNew

func (b *Bundle) ValidateNew(nb Resources) error

ValidateNew checks if a new bundle's contained configuration is valid to be derived from the current bundle. This allows checks of the nature "Make sure that the consensus type did not change".

type BundleActor added in v1.4.1

type BundleActor func(bundle *Bundle)

BundleActor performs an operation based on the given bundle

type BundleSource

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

BundleSource stores a reference to the current configuration bundle It also provides a method to update this bundle. The assorted methods largely pass through to the underlying bundle, but do so through an atomic pointer so that gross go-routine reads are not vulnerable to out-of-order execution memory type bugs.

func NewBundleSource

func NewBundleSource(bundle *Bundle, callbacks ...BundleActor) *BundleSource

NewBundleSource creates a new BundleSource with an initial Bundle value The callbacks will be invoked whenever the Update method is called for the BundleSource. Note, these callbacks are called immediately before this function returns.

func (*BundleSource) ApplicationConfig

func (bs *BundleSource) ApplicationConfig() (Application, bool)

ApplicationConfig returns the Application config for the channel and whether the Application config exists

func (*BundleSource) ChannelConfig

func (bs *BundleSource) ChannelConfig() Channel

ChannelConfig returns the config.Channel for the chain

func (*BundleSource) ConfigtxValidator

func (bs *BundleSource) ConfigtxValidator() configtx.Validator

ConfigtxValidator returns the configtx.Validator for the channel

func (*BundleSource) ConsortiumsConfig

func (bs *BundleSource) ConsortiumsConfig() (Consortiums, bool)

ConsortiumsConfig() returns the config.Consortiums for the channel and whether the consortiums config exists

func (*BundleSource) MSPManager

func (bs *BundleSource) MSPManager() msp.MSPManager

MSPManager returns the MSP manager constructed for this config

func (*BundleSource) OrdererConfig

func (bs *BundleSource) OrdererConfig() (Orderer, bool)

OrdererConfig returns the config.Orderer for the channel and whether the Orderer config exists

func (*BundleSource) PolicyManager

func (bs *BundleSource) PolicyManager() policies.Manager

PolicyManager returns the policy manager constructed for this config

func (*BundleSource) StableBundle

func (bs *BundleSource) StableBundle() *Bundle

StableBundle returns a pointer to a stable Bundle. It is stable because calls to its assorted methods will always return the same result, as the underlying data structures are immutable. For instance, calling BundleSource.Orderer() and BundleSource.MSPManager() to get first the list of orderer orgs, then querying the MSP for those org definitions could result in a bug because an update might replace the underlying Bundle in between. Therefore, for operations which require consistency between the Bundle calls, the caller should first retrieve a StableBundle, then operate on it.

func (*BundleSource) Update

func (bs *BundleSource) Update(newBundle *Bundle)

Update sets a new bundle as the bundle source and calls any registered callbacks

func (*BundleSource) ValidateNew

func (bs *BundleSource) ValidateNew(resources Resources) error

ValidateNew passes through to the current bundle

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

	// Capabilities defines the capabilities for a channel
	Capabilities() ChannelCapabilities
}

Channel gives read only access to the channel configuration

type ChannelCapabilities

type ChannelCapabilities interface {
	// Supported returns an error if there are unknown capabilities in this channel which are required
	Supported() error

	// MSPVersion specifies the version of the MSP this channel must understand, including the MSP types
	// and MSP principal types.
	MSPVersion() msp.MSPVersion

	// ConsensusTypeMigration return true if consensus-type migration is permitted in both orderer and peer.
	ConsensusTypeMigration() bool
}

ChannelCapabilities defines the capabilities for a channel

type ChannelConfig

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

ChannelConfig stores the channel configuration

func NewChannelConfig

func NewChannelConfig(channelGroup *cb.ConfigGroup) (*ChannelConfig, error)

NewChannelConfig creates a new ChannelConfig

func (*ChannelConfig) ApplicationConfig

func (cc *ChannelConfig) ApplicationConfig() *ApplicationConfig

ApplicationConfig returns the application config associated with this channel

func (*ChannelConfig) BlockDataHashingStructureWidth

func (cc *ChannelConfig) BlockDataHashingStructureWidth() uint32

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

func (*ChannelConfig) Capabilities

func (cc *ChannelConfig) Capabilities() ChannelCapabilities

Capabilities returns information about the available capabilities for this channel

func (*ChannelConfig) ConsortiumName

func (cc *ChannelConfig) ConsortiumName() string

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

func (*ChannelConfig) ConsortiumsConfig

func (cc *ChannelConfig) ConsortiumsConfig() *ConsortiumsConfig

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

func (*ChannelConfig) HashingAlgorithm

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

HashingAlgorithm returns a function pointer to the chain hashing algorihtm

func (*ChannelConfig) MSPManager

func (cc *ChannelConfig) MSPManager() msp.MSPManager

MSPManager returns the MSP manager for this config

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) OrdererConfig

func (cc *ChannelConfig) OrdererConfig() *OrdererConfig

OrdererConfig returns the orderer config associated with this channel

func (*ChannelConfig) Validate

func (cc *ChannelConfig) Validate() error

Validate inspects the generated configuration protos and ensures that the values are correct

type ChannelProtos

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

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 ConfigValue

type ConfigValue interface {
	// Key is the key this value should be stored in the *cb.ConfigGroup.Values map.
	Key() string

	// Value is the message which should be marshaled to opaque bytes for the *cb.ConfigValue.value.
	Value() proto.Message
}

ConfigValue defines a common representation for different *cb.ConfigValue values.

type Consortium

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

	// Organizations returns the organizations for this consortium
	Organizations() map[string]Org
}

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(consortiumGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ConsortiumConfig, error)

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) Organizations

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

Organizations returns the set of organizations in the consortium

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(consortiumsGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ConsortiumsConfig, error)

NewConsortiumsConfig creates a new instance of the consoritums config

func (*ConsortiumsConfig) Consortiums

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

Consortiums returns a map of the current consortiums

type MSPConfigHandler

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

MSPConfigHandler

func NewMSPConfigHandler

func NewMSPConfigHandler(mspVersion msp.MSPVersion) *MSPConfigHandler

func (*MSPConfigHandler) CreateMSPManager

func (bh *MSPConfigHandler) CreateMSPManager() (msp.MSPManager, error)

func (*MSPConfigHandler) ProposeMSP

func (bh *MSPConfigHandler) ProposeMSP(mspConfig *mspprotos.MSPConfig) (msp.MSP, error)

ProposeValue called when an org defines an MSP

type Orderer

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

	// ConsensusMetadata returns the metadata associated with the consensus type.
	ConsensusMetadata() []byte

	// ConsensusMigrationState returns the consensus-type migration state.
	ConsensusMigrationState() ab.ConsensusType_MigrationState

	// ConsensusMigrationContext returns the consensus-type migration context.
	ConsensusMigrationContext() uint64

	// 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]OrdererOrg

	// Capabilities defines the capabilities for the orderer portion of a channel
	Capabilities() OrdererCapabilities
}

Orderer stores the common shared orderer config

type OrdererCapabilities

type OrdererCapabilities interface {
	// PredictableChannelTemplate specifies whether the v1.0 undesirable behavior of setting the /Channel
	// group's mod_policy to "" and copy versions from the orderer system channel config should be fixed or not.
	PredictableChannelTemplate() bool

	// Resubmission specifies whether the v1.0 non-deterministic commitment of tx should be fixed by re-submitting
	// the re-validated tx.
	Resubmission() bool

	// Supported returns an error if there are unknown capabilities in this channel which are required
	Supported() error

	// ExpirationCheck specifies whether the orderer checks for identity expiration checks
	// when validating messages
	ExpirationCheck() bool

	// Kafka2RaftMigration checks whether the orderer permits a Kafka to Raft migration.
	Kafka2RaftMigration() bool

	// UseChannelCreationPolicyAsAdmins checks whether the orderer should use more sophisticated
	// channel creation logic using channel creation policy as the Admins policy if
	// the creation transaction appears to support it.
	UseChannelCreationPolicyAsAdmins() bool
}

OrdererCapabilities defines the capabilities for the orderer portion of a channel

type OrdererConfig

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

OrdererConfig holds the orderer configuration information.

func NewOrdererConfig

func NewOrdererConfig(ordererGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*OrdererConfig, error)

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) Capabilities

func (oc *OrdererConfig) Capabilities() OrdererCapabilities

Capabilities returns the capabilities the ordering network has for this channel.

func (*OrdererConfig) ConsensusMetadata added in v1.3.0

func (oc *OrdererConfig) ConsensusMetadata() []byte

ConsensusMetadata returns the metadata associated with the consensus type.

func (*OrdererConfig) ConsensusMigrationContext added in v1.4.1

func (oc *OrdererConfig) ConsensusMigrationContext() uint64

ConsensusMigrationContext return the consensus type migration context.

func (*OrdererConfig) ConsensusMigrationState added in v1.4.1

func (oc *OrdererConfig) ConsensusMigrationState() ab.ConsensusType_MigrationState

ConsensusMigrationState return the consensus type migration state.

func (*OrdererConfig) ConsensusType

func (oc *OrdererConfig) ConsensusType() string

ConsensusType returns the configured consensus type.

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]OrdererOrg

Organizations returns a map of the orgs in the channel.

func (*OrdererConfig) Validate

func (oc *OrdererConfig) Validate() error

type OrdererOrg added in v1.4.2

type OrdererOrg interface {
	Org

	// Endpoints returns the endpoints of orderer nodes.
	Endpoints() []string
}

OrdererOrg stores the per org orderer config.

type OrdererOrgConfig added in v1.4.2

type OrdererOrgConfig struct {
	*OrganizationConfig
}

OrdererOrgConfig defines the configuration for an orderer org

func NewOrdererOrgConfig added in v1.4.2

func NewOrdererOrgConfig(orgName string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler) (*OrdererOrgConfig, error)

NewOrdererOrgConfig returns an orderer org config built from the given ConfigGroup.

func (*OrdererOrgConfig) Endpoints added in v1.4.2

func (*OrdererOrgConfig) Endpoints() []string

type OrdererProtos

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

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
}

OrganizationConfig stores the configuration for an organization

func NewOrganizationConfig

func NewOrganizationConfig(name string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler) (*OrganizationConfig, error)

NewOrganizationConfig creates a new config for an organization

func (*OrganizationConfig) MSPID

func (oc *OrganizationConfig) MSPID() string

MSPID returns the MSP ID associated with this org

func (*OrganizationConfig) Name

func (oc *OrganizationConfig) Name() string

Name returns the name this org is referred to in config

func (*OrganizationConfig) Validate

func (oc *OrganizationConfig) Validate() error

Validate returns whether the configuration is valid

type OrganizationProtos

type OrganizationProtos struct {
	MSP *mspprotos.MSPConfig
}

OrganizationProtos are used to deserialize the organization config

type PolicyMapper added in v1.2.0

type PolicyMapper interface {
	// PolicyRefForAPI takes the name of an API, and returns the policy name
	// or the empty string if the API is not found
	PolicyRefForAPI(apiName string) string
}

PolicyMapper is an interface for

type Resources

type Resources interface {
	// ConfigtxValidator returns the configtx.Validator for the channel
	ConfigtxValidator() configtx.Validator

	// PolicyManager returns the policies.Manager for the channel
	PolicyManager() policies.Manager

	// ChannelConfig returns the config.Channel for the chain
	ChannelConfig() Channel

	// OrdererConfig returns the config.Orderer for the channel
	// and whether the Orderer config exists
	OrdererConfig() (Orderer, bool)

	// ConsortiumsConfig() returns the config.Consortiums for the channel
	// and whether the consortiums config exists
	ConsortiumsConfig() (Consortiums, bool)

	// ApplicationConfig returns the configtxapplication.SharedConfig for the channel
	// and whether the Application config exists
	ApplicationConfig() (Application, bool)

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

	// ValidateNew should return an error if a new set of configuration resources is incompatible with the current one
	ValidateNew(resources Resources) error
}

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

type StandardConfigValue

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

StandardConfigValue implements the ConfigValue interface.

func ACLValues added in v1.2.0

func ACLValues(acls map[string]string) *StandardConfigValue

ACLsValues returns the config definition for an applications resources based ACL definitions. It is a value for the /Channel/Application/.

func AnchorPeersValue

func AnchorPeersValue(anchorPeers []*pb.AnchorPeer) *StandardConfigValue

AnchorPeersValue returns the config definition for an org's anchor peers. It is a value for the /Channel/Application/*.

func BatchSizeValue

func BatchSizeValue(maxMessages, absoluteMaxBytes, preferredMaxBytes uint32) *StandardConfigValue

BatchSizeValue returns the config definition for the orderer batch size. It is a value for the /Channel/Orderer group.

func BatchTimeoutValue

func BatchTimeoutValue(timeout string) *StandardConfigValue

BatchTimeoutValue returns the config definition for the orderer batch timeout. It is a value for the /Channel/Orderer group.

func BlockDataHashingStructureValue

func BlockDataHashingStructureValue() *StandardConfigValue

BlockDataHashingStructureValue returns the only currently valid block data hashing structure. It is a value for the /Channel group.

func CapabilitiesValue

func CapabilitiesValue(capabilities map[string]bool) *StandardConfigValue

CapabilitiesValue returns the config definition for a a set of capabilities. It is a value for the /Channel/Orderer, Channel/Application/, and /Channel groups.

func ChannelCreationPolicyValue

func ChannelCreationPolicyValue(policy *cb.Policy) *StandardConfigValue

ChannelCreationPolicyValue returns the config definition for a consortium's channel creation policy It is a value for the /Channel/Consortiums/*/*.

func ChannelRestrictionsValue

func ChannelRestrictionsValue(maxChannelCount uint64) *StandardConfigValue

ChannelRestrictionsValue returns the config definition for the orderer channel restrictions. It is a value for the /Channel/Orderer group.

func ConsensusTypeValue

func ConsensusTypeValue(consensusType string, consensusMetadata []byte) *StandardConfigValue

ConsensusTypeValue returns the config definition for the orderer consensus type. It is a value for the /Channel/Orderer group.

func ConsortiumValue

func ConsortiumValue(name string) *StandardConfigValue

ConsortiumValue returns the config definition for the consortium name. It is a value for the channel group.

func HashingAlgorithmValue

func HashingAlgorithmValue() *StandardConfigValue

HashingAlgorithm returns the only currently valid hashing algorithm. It is a value for the /Channel group.

func KafkaBrokersValue

func KafkaBrokersValue(brokers []string) *StandardConfigValue

KafkaBrokersValue returns the config definition for the addresses of the ordering service's Kafka brokers. It is a value for the /Channel/Orderer group.

func MSPValue

func MSPValue(mspDef *mspprotos.MSPConfig) *StandardConfigValue

MSPValue returns the config definition for an MSP. It is a value for the /Channel/Orderer/*, /Channel/Application/*, and /Channel/Consortiums/*/*/* groups.

func OrdererAddressesValue

func OrdererAddressesValue(addresses []string) *StandardConfigValue

OrdererAddressesValue returns the a config definition for the orderer addresses. It is a value for the /Channel group.

func (*StandardConfigValue) Key

func (scv *StandardConfigValue) Key() string

Key is the key this value should be stored in the *cb.ConfigGroup.Values map.

func (*StandardConfigValue) Value

func (scv *StandardConfigValue) Value() proto.Message

Value is the message which should be marshaled to opaque bytes for the *cb.ConfigValue.value.

type StandardValues

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

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 (*StandardValues) Deserialize

func (sv *StandardValues) 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

Jump to

Keyboard shortcuts

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