func (oc *OrdererConfig) ConsensusMetadata() []byte {
	return oc.protos.ConsensusType.Metadata
}
ConsensusMetadata returns the metadata associated with the consensus type.
package channelconfig
import (
	"fmt"
	"regexp"
	"strconv"
	"strings"
	"time"
	cb "github.com/hyperledger/fabric-protos-go/common"
	ab "github.com/hyperledger/fabric-protos-go/orderer"
	"github.com/kfsoftware/hlf-operator/internal/github.com/hyperledger/fabric/common/capabilities"
	"github.com/pkg/errors"
)
const (
	OrdererGroupKey = "Orderer"
)
const (
	ConsensusTypeKey = "ConsensusType"
	BatchSizeKey = "BatchSize"
	BatchTimeoutKey = "BatchTimeout"
	ChannelRestrictionsKey = "ChannelRestrictions"
	KafkaBrokersKey = "KafkaBrokers"
	EndpointsKey = "Endpoints"
)
type OrdererProtos struct {
	ConsensusType       *ab.ConsensusType
	BatchSize           *ab.BatchSize
	BatchTimeout        *ab.BatchTimeout
	KafkaBrokers        *ab.KafkaBrokers
	ChannelRestrictions *ab.ChannelRestrictions
	Capabilities        *cb.Capabilities
}
type OrdererConfig struct {
	protos *OrdererProtos
	orgs   map[string]OrdererOrg
	batchTimeout time.Duration
}
type OrdererOrgProtos struct {
	Endpoints *cb.OrdererAddresses
}
type OrdererOrgConfig struct {
	*OrganizationConfig
	protos *OrdererOrgProtos
	name   string
}
func (oc *OrdererOrgConfig) Endpoints() []string {
	return oc.protos.Endpoints.Addresses
}
func NewOrdererOrgConfig(orgName string, orgGroup *cb.ConfigGroup, mspConfigHandler *MSPConfigHandler, channelCapabilities ChannelCapabilities) (*OrdererOrgConfig, error) {
	if len(orgGroup.Groups) > 0 {
		return nil, fmt.Errorf("OrdererOrg config does not allow sub-groups")
	}
	if !channelCapabilities.OrgSpecificOrdererEndpoints() {
		if _, ok := orgGroup.Values[EndpointsKey]; ok {
			return nil, errors.Errorf("Orderer Org %s cannot contain endpoints value until V1_4_2+ capabilities have been enabled", orgName)
		}
	}
	protos := &OrdererOrgProtos{}
	orgProtos := &OrganizationProtos{}
	if err := DeserializeProtoValuesFromGroup(orgGroup, protos, orgProtos); err != nil {
		return nil, errors.Wrap(err, "failed to deserialize values")
	}
	ooc := &OrdererOrgConfig{
		name:   orgName,
		protos: protos,
		OrganizationConfig: &OrganizationConfig{
			name:             orgName,
			protos:           orgProtos,
			mspConfigHandler: mspConfigHandler,
		},
	}
	if err := ooc.Validate(); err != nil {
		return nil, err
	}
	return ooc, nil
}
func (ooc *OrdererOrgConfig) Validate() error {
	return ooc.OrganizationConfig.Validate()
}
func NewOrdererConfig(ordererGroup *cb.ConfigGroup, mspConfig *MSPConfigHandler, channelCapabilities ChannelCapabilities) (*OrdererConfig, error) {
	oc := &OrdererConfig{
		protos: &OrdererProtos{},
		orgs:   make(map[string]OrdererOrg),
	}
	if err := DeserializeProtoValuesFromGroup(ordererGroup, oc.protos); err != nil {
		return nil, errors.Wrap(err, "failed to deserialize values")
	}
	if err := oc.Validate(); err != nil {
		return nil, err
	}
	for orgName, orgGroup := range ordererGroup.Groups {
		var err error
		if oc.orgs[orgName], err = NewOrdererOrgConfig(orgName, orgGroup, mspConfig, channelCapabilities); err != nil {
			return nil, err
		}
	}
	return oc, nil
}
func (oc *OrdererConfig) ConsensusType() string {
	return oc.protos.ConsensusType.Type
}