configtx

package
v1.0.8-5 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConsensusTypeSolo identifies the solo consensus implementation.
	ConsensusTypeSolo = "solo"
	// ConsensusTypeKafka identifies the Kafka-based consensus implementation.
	ConsensusTypeKafka = "kafka"
	// ConsensusTypeKafka identifies the Kafka-based consensus implementation.
	ConsensusTypeEtcdRaft = "etcdraft"

	// BlockValidationPolicyKey
	BlockValidationPolicyKey = "BlockValidation"

	// OrdererAdminsPolicy is the absolute path to the orderer admins policy
	OrdererAdminsPolicy = "/Channel/Orderer/Admins"

	// SignaturePolicyType is the 'Type' string for signature policies
	SignaturePolicyType = "Signature"

	// ImplicitMetaPolicyType is the 'Type' string for implicit meta policies
	ImplicitMetaPolicyType = "ImplicitMeta"

	// AdminRoleAdminPrincipal is set as AdminRole to cause the MSP role of
	// type Admin to be used as the admin principal default
	AdminRoleAdminPrincipal = "Role.ADMIN"
)

Variables

This section is empty.

Functions

func AddPolicies

func AddPolicies(cg *cb.ConfigGroup, policyMap map[string]*Policy, modPolicy string) error

func NewApplicationGroup

func NewApplicationGroup(conf *Application) (*cb.ConfigGroup, error)

NewApplicationGroup returns the application component of the channel configuration. It defines the organizations which are involved in application logic like chaincodes, and how these members may interact with the orderer. It sets the mod_policy of all elements to "Admins".

func NewApplicationOrgGroup

func NewApplicationOrgGroup(conf *Organization) (*cb.ConfigGroup, error)

NewApplicationOrgGroup returns an application org component of the channel configuration. It defines the crypto material for the organization (its MSP) as well as its anchor peers for use by the gossip network. It sets the mod_policy of all elements to "Admins".

func NewConsortiumGroup

func NewConsortiumGroup(conf *Consortium) (*cb.ConfigGroup, error)

NewConsortiums returns a consortiums component of the channel configuration. Each consortium defines the organizations which may be involved in channel creation, as well as the channel creation policy the orderer checks at channel creation time to authorize the action. It sets the mod_policy of all elements to "/Channel/Orderer/Admins".

func NewConsortiumOrgGroup

func NewConsortiumOrgGroup(conf *Organization) (*cb.ConfigGroup, error)

NewConsortiumsGroup returns an org component of the channel configuration. It defines the crypto material for the organization (its MSP). It sets the mod_policy of all elements to "Admins".

func NewConsortiumsGroup

func NewConsortiumsGroup(conf map[string]*Consortium) (*cb.ConfigGroup, error)

NewConsortiumsGroup returns the consortiums component of the channel configuration. This element is only defined for the ordering system channel. It sets the mod_policy for all elements to "/Channel/Orderer/Admins".

func NewOrdererOrgGroup

func NewOrdererOrgGroup(conf *Organization, mspConfig *msp.MSPConfig) (*cb.ConfigGroup, error)

NewOrdererOrgGroup returns an orderer org component of the channel configuration. It defines the crypto material for the organization (its MSP). It sets the mod_policy of all elements to "Admins".

func ValidateOrg

func ValidateOrg(org *Organization) error

Types

type AnchorPeer

type AnchorPeer struct {
	Host string `yaml:"Host"`
	Port int    `yaml:"Port"`
}

AnchorPeer encodes the necessary fields to identify an anchor peer.

type Application

type Application struct {
	Organizations []*Organization    `yaml:"Organizations"`
	Capabilities  map[string]bool    `yaml:"Capabilities"`
	Resources     *Resources         `yaml:"Resources"`
	Policies      map[string]*Policy `yaml:"Policies"`
	ACLs          map[string]string  `yaml:"ACLs"`
}

Application encodes the application-level configuration needed in config transactions.

type BatchSize

type BatchSize struct {
	MaxMessageCount   uint32 `yaml:"MaxMessageCount"`
	AbsoluteMaxBytes  uint32 `yaml:"AbsoluteMaxBytes"`
	PreferredMaxBytes uint32 `yaml:"PreferredMaxBytes"`
}

BatchSize contains configuration affecting the size of batches.

type ConfigTx

type ConfigTx struct {
	Config *TopLevel
}

func New

func New() *ConfigTx

func (*ConfigTx) CompleteOrdererInitialization

func (c *ConfigTx) CompleteOrdererInitialization(ord *Orderer) error

func (*ConfigTx) CompleteProfileInitialization

func (c *ConfigTx) CompleteProfileInitialization(p *Profile) error

func (*ConfigTx) GetProfile

func (c *ConfigTx) GetProfile(name string) (*Profile, error)

type Consortium

type Consortium struct {
	Organizations []*Organization `yaml:"Organizations"`
}

Consortium represents a group of organizations which may create channels with each other

type Kafka

type Kafka struct {
	Brokers []string `yaml:"Brokers"`
}

Kafka contains configuration for the Kafka-based orderer.

type Orderer

type Orderer struct {
	OrdererType   string                   `yaml:"OrdererType"`
	Addresses     []string                 `yaml:"Addresses"`
	BatchTimeout  time.Duration            `yaml:"BatchTimeout"`
	BatchSize     BatchSize                `yaml:"BatchSize"`
	Kafka         Kafka                    `yaml:"Kafka"`
	EtcdRaft      *etcdraft.ConfigMetadata `yaml:"EtcdRaft"`
	Organizations []*Organization          `yaml:"Organizations"`
	MaxChannels   uint64                   `yaml:"MaxChannels"`
	Capabilities  map[string]bool          `yaml:"Capabilities"`
	Policies      map[string]*Policy       `yaml:"Policies"`
}

Orderer contains configuration associated to a channel.

type Organization

type Organization struct {
	Name     string             `yaml:"Name"`
	ID       string             `yaml:"ID"`
	MSPDir   string             `yaml:"MSPDir"`
	MSPType  string             `yaml:"MSPType"`
	Policies map[string]*Policy `yaml:"Policies"`

	// Note: Viper deserialization does not seem to care for
	// embedding of types, so we use one organization struct
	// for both orderers and applications.
	AnchorPeers      []*AnchorPeer `yaml:"AnchorPeers"`
	OrdererEndpoints []string      `yaml:"OrdererEndpoints"`

	// AdminPrincipal is deprecated and may be removed in a future release
	// it was used for modifying the default policy generation, but policies
	// may now be specified explicitly so it is redundant and unnecessary
	AdminPrincipal string `yaml:"AdminPrincipal"`

	// SkipAsForeign indicates that this org definition is actually unknown to this
	// instance of the tool, so, parsing of this org's parameters should be ignored.
	SkipAsForeign bool
}

Organization encodes the organization-level configuration needed in config transactions.

type Policy

type Policy struct {
	Type string `yaml:"Type"`
	Rule string `yaml:"Rule"`
}

Policy encodes a channel config policy

type Profile

type Profile struct {
	Consortium   string                 `yaml:"Consortium"`
	Application  *Application           `yaml:"Application"`
	Orderer      *Orderer               `yaml:"Orderer"`
	Consortiums  map[string]*Consortium `yaml:"Consortiums"`
	Capabilities map[string]bool        `yaml:"Capabilities"`
	Policies     map[string]*Policy     `yaml:"Policies"`
}

Profile encodes orderer/application configuration combinations for the configtxgen tool.

func (*Profile) AddConsortium

func (p *Profile) AddConsortium(name string, consortium *Consortium) error

func (*Profile) AddOrdererAddress

func (p *Profile) AddOrdererAddress(address string)

func (*Profile) AddOrgToConsortium

func (p *Profile) AddOrgToConsortium(name string, org *Organization) error

func (*Profile) AddOrgToOrderer

func (p *Profile) AddOrgToOrderer(org *Organization) error

func (*Profile) AddRaftConsentingNode

func (p *Profile) AddRaftConsentingNode(consenter *etcdraft.Consenter) error

func (*Profile) Block

func (p *Profile) Block(channelID string, channelGroup *cb.ConfigGroup) *cb.Block

func (*Profile) GenerateBlock

func (p *Profile) GenerateBlock(channelID string, mspConfigs map[string]*msp.MSPConfig) ([]byte, error)

func (*Profile) NewChannelConfigGroup

func (p *Profile) NewChannelConfigGroup(mspConfigs map[string]*msp.MSPConfig) (*cb.ConfigGroup, error)

func (*Profile) NewOrdererGroup

func (p *Profile) NewOrdererGroup(conf *Orderer, mspConfigs map[string]*msp.MSPConfig) (*cb.ConfigGroup, error)

func (*Profile) SetCapabilitiesForOrderer

func (p *Profile) SetCapabilitiesForOrderer(capabilities map[string]bool)

func (*Profile) SetChannelPolicy

func (p *Profile) SetChannelPolicy(policies map[string]*Policy)

func (*Profile) SetMaxChannel

func (p *Profile) SetMaxChannel(max uint64)

func (*Profile) SetOrdererType

func (p *Profile) SetOrdererType(ordererType string)

type Resources

type Resources struct {
	DefaultModPolicy string
}

Resources encodes the application-level resources configuration needed to seed the resource tree

type TopLevel

type TopLevel struct {
	Profiles      map[string]*Profile        `yaml:"Profiles"`
	Organizations []*Organization            `yaml:"Organizations"`
	Channel       *Profile                   `yaml:"Channel"`
	Application   *Application               `yaml:"Application"`
	Orderer       *Orderer                   `yaml:"Orderer"`
	Capabilities  map[string]map[string]bool `yaml:"Capabilities"`
	Resources     *Resources                 `yaml:"Resources"`
}

TopLevel consists of the structs used by the configtxgen tool.

func GetGenesisDefaults

func GetGenesisDefaults() *TopLevel

+k8s:openapi-gen=true

func LoadTopLevelConfig

func LoadTopLevelConfig(configFile string) (*TopLevel, error)

Jump to

Keyboard shortcuts

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