...

Package channelconfig

import "github.com/hyperledger/fabric/common/channelconfig"
Overview
Index

Overview ▾

Index ▾

Constants
func DeserializeProtoValuesFromGroup(group *cb.ConfigGroup, protosStructs ...interface{}) error
func LogSanityChecks(res Resources)
func MarshalEtcdRaftMetadata(md *etcdraft.ConfigMetadata) ([]byte, error)
func MarshalSmartBFTMetadata(md *smartbft.ConfigMetadata) ([]byte, error)
func ValidateCapabilities(block *cb.Block) error
type Application
type ApplicationCapabilities
type ApplicationConfig
    func NewApplicationConfig(appGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ApplicationConfig, error)
    func (ac *ApplicationConfig) APIPolicyMapper() PolicyMapper
    func (ac *ApplicationConfig) Capabilities() ApplicationCapabilities
    func (ac *ApplicationConfig) Organizations() map[string]ApplicationOrg
type ApplicationOrg
type ApplicationOrgConfig
    func NewApplicationOrgConfig(id string, orgGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ApplicationOrgConfig, error)
    func (aog *ApplicationOrgConfig) AnchorPeers() []*pb.AnchorPeer
    func (aoc *ApplicationOrgConfig) Validate() error
type ApplicationOrgProtos
type ApplicationProtos
type Bundle
    func NewBundle(channelID string, config *cb.Config) (*Bundle, error)
    func NewBundleFromEnvelope(env *cb.Envelope) (*Bundle, error)
    func (b *Bundle) ApplicationConfig() (Application, bool)
    func (b *Bundle) ChannelConfig() Channel
    func (b *Bundle) ConfigtxValidator() configtx.Validator
    func (b *Bundle) ConsortiumsConfig() (Consortiums, bool)
    func (b *Bundle) MSPManager() msp.MSPManager
    func (b *Bundle) OrdererConfig() (Orderer, bool)
    func (b *Bundle) PolicyManager() policies.Manager
    func (b *Bundle) ValidateNew(nb Resources) error
type BundleActor
type BundleSource
    func NewBundleSource(bundle *Bundle, callbacks ...BundleActor) *BundleSource
    func (bs *BundleSource) ApplicationConfig() (Application, bool)
    func (bs *BundleSource) ChannelConfig() Channel
    func (bs *BundleSource) ConfigtxValidator() configtx.Validator
    func (bs *BundleSource) ConsortiumsConfig() (Consortiums, bool)
    func (bs *BundleSource) MSPManager() msp.MSPManager
    func (bs *BundleSource) OrdererConfig() (Orderer, bool)
    func (bs *BundleSource) PolicyManager() policies.Manager
    func (bs *BundleSource) StableBundle() *Bundle
    func (bs *BundleSource) Update(newBundle *Bundle)
    func (bs *BundleSource) ValidateNew(resources Resources) error
type Channel
type ChannelCapabilities
type ChannelConfig
    func NewChannelConfig(channelGroup *cb.ConfigGroup) (*ChannelConfig, error)
    func (cc *ChannelConfig) ApplicationConfig() *ApplicationConfig
    func (cc *ChannelConfig) BlockDataHashingStructureWidth() uint32
    func (cc *ChannelConfig) Capabilities() ChannelCapabilities
    func (cc *ChannelConfig) ConsortiumName() string
    func (cc *ChannelConfig) ConsortiumsConfig() *ConsortiumsConfig
    func (cc *ChannelConfig) HashingAlgorithm() func(input []byte) []byte
    func (cc *ChannelConfig) MSPManager() msp.MSPManager
    func (cc *ChannelConfig) OrdererAddresses() []string
    func (cc *ChannelConfig) OrdererConfig() *OrdererConfig
    func (cc *ChannelConfig) Validate(channelCapabilities ChannelCapabilities) error
type ChannelProtos
type ChannelValues
type ConfigValue
type Consortium
type ConsortiumConfig
    func NewConsortiumConfig(consortiumGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ConsortiumConfig, error)
    func (cc *ConsortiumConfig) ChannelCreationPolicy() *cb.Policy
    func (cc *ConsortiumConfig) Organizations() map[string]Org
type ConsortiumProtos
type Consortiums
type ConsortiumsConfig
    func NewConsortiumsConfig(consortiumsGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler) (*ConsortiumsConfig, error)
    func (cc *ConsortiumsConfig) Consortiums() map[string]Consortium
type MSPConfigHandler
    func NewMSPConfigHandler(mspVersion msp.MSPVersion) *MSPConfigHandler
    func (bh *MSPConfigHandler) CreateMSPManager() (msp.MSPManager, error)
    func (bh *MSPConfigHandler) ProposeMSP(mspConfig *mspprotos.MSPConfig) (msp.MSP, error)
type Orderer
type OrdererCapabilities
type OrdererConfig
    func NewOrdererConfig(ordererGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler, channelCapabilities ChannelCapabilities) (*OrdererConfig, error)
    func (oc *OrdererConfig) BatchSize() *ab.BatchSize
    func (oc *OrdererConfig) BatchTimeout() time.Duration
    func (oc *OrdererConfig) Capabilities() OrdererCapabilities
    func (oc *OrdererConfig) ConsensusMetadata() []byte
    func (oc *OrdererConfig) ConsensusState() ab.ConsensusType_State
    func (oc *OrdererConfig) ConsensusType() string
    func (oc *OrdererConfig) KafkaBrokers() []string
    func (oc *OrdererConfig) MaxChannelsCount() uint64
    func (oc *OrdererConfig) Organizations() map[string]OrdererOrg
    func (oc *OrdererConfig) Validate() error
type OrdererOrg
type OrdererOrgConfig
    func NewOrdererOrgConfig(orgName string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler, channelCapabilities ChannelCapabilities) (*OrdererOrgConfig, error)
    func (oc *OrdererOrgConfig) Endpoints() []string
    func (ooc *OrdererOrgConfig) Validate() error
type OrdererOrgProtos
type OrdererProtos
type Org
type OrganizationConfig
    func NewOrganizationConfig(name string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler) (*OrganizationConfig, error)
    func (oc *OrganizationConfig) MSPID() string
    func (oc *OrganizationConfig) Name() string
    func (oc *OrganizationConfig) Validate() error
type OrganizationProtos
type PolicyMapper
type Resources
type StandardConfigValue
    func ACLValues(acls map[string]string) *StandardConfigValue
    func AnchorPeersValue(anchorPeers []*pb.AnchorPeer) *StandardConfigValue
    func BatchSizeValue(maxMessages, absoluteMaxBytes, preferredMaxBytes uint32) *StandardConfigValue
    func BatchTimeoutValue(timeout string) *StandardConfigValue
    func BlockDataHashingStructureValue() *StandardConfigValue
    func CapabilitiesValue(capabilities map[string]bool) *StandardConfigValue
    func ChannelCreationPolicyValue(policy *cb.Policy) *StandardConfigValue
    func ChannelRestrictionsValue(maxChannelCount uint64) *StandardConfigValue
    func ConsensusTypeValue(consensusType string, consensusMetadata []byte) *StandardConfigValue
    func ConsortiumValue(name string) *StandardConfigValue
    func EndpointsValue(addresses []string) *StandardConfigValue
    func HashingAlgorithmValue() *StandardConfigValue
    func KafkaBrokersValue(brokers []string) *StandardConfigValue
    func MSPValue(mspDef *mspprotos.MSPConfig) *StandardConfigValue
    func OrdererAddressesValue(addresses []string) *StandardConfigValue
    func (scv *StandardConfigValue) Key() string
    func (scv *StandardConfigValue) Value() proto.Message
type StandardValues
    func NewStandardValues(protosStructs ...interface{}) (*StandardValues, error)
    func (sv *StandardValues) Deserialize(key string, value []byte) (proto.Message, error)

Package files

acls.go api.go application.go applicationorg.go bundle.go bundlesource.go channel.go consortium.go consortiums.go logsanitychecks.go msp.go orderer.go organization.go standardvalues.go util.go

Constants

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

    // ACLsKey is the name of the ACLs config
    ACLsKey = "ACLs"
)

Channel config keys

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

    // EndpointsKey is the cb.COnfigValue key name for the Endpoints message in the OrdererOrgGroup.
    EndpointsKey = "Endpoints"
)
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"
)
const (
    // AnchorPeersKey is the key name for the AnchorPeers ConfigValue
    AnchorPeersKey = "AnchorPeers"
)
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"
)
const (
    // ConsortiumsGroupKey is the group name for the consortiums config
    ConsortiumsGroupKey = "Consortiums"
)
const (
    // MSPKey is the key for the MSP definition in orderer groups
    MSPKey = "MSP"
)
const (
    // OrdererGroupKey is the group name for the orderer config.
    OrdererGroupKey = "Orderer"
)

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

const RootGroupKey = "Channel"

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 MarshalSmartBFTMetadata

func MarshalSmartBFTMetadata(md *smartbft.ConfigMetadata) ([]byte, error)

MarshalSmartBFTMetadata serializes Smart BFT metadata.

func ValidateCapabilities

func ValidateCapabilities(block *cb.Block) error

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

type Application

Application stores the common shared application config

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
}

type ApplicationCapabilities

ApplicationCapabilities defines the capabilities for the application portion of a channel

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

    // StorePvtDataOfInvalidTx() returns true if the peer needs to store the pvtData of
    // invalid transactions.
    StorePvtDataOfInvalidTx() bool

    // MetadataLifecycle indicates whether the peer should use the deprecated and problematic
    // v1.0/v1.1 lifecycle, or whether it should use the newer per channel peer local chaincode
    // metadata package approach planned for release with Fabric v1.2
    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
}

type ApplicationConfig

ApplicationConfig implements the Application interface

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

func NewApplicationConfig

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

NewApplicationConfig creates config from an Application config group

func (*ApplicationConfig) APIPolicyMapper

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

ApplicationOrg stores the per org application config

type ApplicationOrg interface {
    Org

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

type ApplicationOrgConfig

ApplicationOrgConfig defines the configuration for an application org

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

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

ApplicationOrgProtos are deserialized from the config

type ApplicationOrgProtos struct {
    AnchorPeers *pb.AnchorPeers
}

type ApplicationProtos

ApplicationProtos is used as the source of the ApplicationConfig

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

type Bundle

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.

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

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

BundleActor performs an operation based on the given bundle

type BundleActor func(bundle *Bundle)

type BundleSource

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.

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

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

Channel gives read only access to the channel configuration

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
}

type ChannelCapabilities

ChannelCapabilities defines the capabilities for a channel

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

    // OrgSpecificOrdererEndpoints return true if the channel config processing allows orderer orgs to specify their own endpoints
    OrgSpecificOrdererEndpoints() bool
}

type ChannelConfig

ChannelConfig stores the channel configuration

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

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(channelCapabilities ChannelCapabilities) error

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

type ChannelProtos

ChannelProtos is where the proposed configuration is unmarshaled into

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

type ChannelValues

ChannelValues gives read only access to the channel configuration

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
}

type ConfigValue

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

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
}

type Consortium

Consortium represents a group of orgs which may create channels together

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
}

type ConsortiumConfig

ConsortiumConfig holds the consoritums configuration information

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

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

ConsortiumProtos holds the config protos for the consortium config

type ConsortiumProtos struct {
    ChannelCreationPolicy *cb.Policy
}

type Consortiums

Consortiums represents the set of consortiums serviced by an ordering service

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

type ConsortiumsConfig

ConsortiumsConfig holds the consoritums configuration information

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

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

MSPConfigHandler

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

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

Orderer stores the common shared orderer config

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

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

    // ConsensusState returns the consensus-type state.
    ConsensusState() ab.ConsensusType_State

    // 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
}

type OrdererCapabilities

OrdererCapabilities defines the capabilities for the orderer portion of a channel

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

    // ConsensusTypeMigration checks whether the orderer permits a consensus-type migration.
    ConsensusTypeMigration() bool
}

type OrdererConfig

OrdererConfig holds the orderer configuration information.

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

func NewOrdererConfig

func NewOrdererConfig(ordererGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler, channelCapabilities ChannelCapabilities) (*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

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

ConsensusMetadata returns the metadata associated with the consensus type.

func (*OrdererConfig) ConsensusState

func (oc *OrdererConfig) ConsensusState() ab.ConsensusType_State

ConsensusState return the consensus type 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

OrdererOrg stores the per org orderer config.

type OrdererOrg interface {
    Org

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

type OrdererOrgConfig

OrdererOrgConfig defines the configuration for an orderer org

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

func NewOrdererOrgConfig

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

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

func (*OrdererOrgConfig) Endpoints

func (oc *OrdererOrgConfig) Endpoints() []string

Endpoints returns the set of addresses this ordering org exposes as orderers

func (*OrdererOrgConfig) Validate

func (ooc *OrdererOrgConfig) Validate() error

type OrdererOrgProtos

OrdererOrgProtos are deserialized from the Orderer org config values

type OrdererOrgProtos struct {
    Endpoints *cb.OrdererAddresses
}

type OrdererProtos

OrdererProtos is used as the source of the OrdererConfig.

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

type Org

Org stores the common organizational config

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
}

type OrganizationConfig

OrganizationConfig stores the configuration for an organization

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

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

OrganizationProtos are used to deserialize the organization config

type OrganizationProtos struct {
    MSP *mspprotos.MSPConfig
}

type PolicyMapper

PolicyMapper is an interface for

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
}

type Resources

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 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
}

type StandardConfigValue

StandardConfigValue implements the ConfigValue interface.

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

func ACLValues

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 EndpointsValue

func EndpointsValue(addresses []string) *StandardConfigValue

EndpointsValue returns the config definition for the orderer addresses at an org scoped level. It is a value for the /Channel/Orderer/<OrgName> 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