github.com/hellobchain/third_party@v0.0.0-20230331131523-deb0478a2e52/hyperledger/fabric-config/configtx/orderer/orderer.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package orderer 8 9 import ( 10 "github.com/hellobchain/newcryptosm/x509" 11 ) 12 13 const ( 14 15 // ConsensusStateNormal indicates normal orderer operation. 16 ConsensusStateNormal ConsensusState = "STATE_NORMAL" 17 18 // ConsensusStateMaintenance indicates the orderer is in consensus type migration. 19 ConsensusStateMaintenance ConsensusState = "STATE_MAINTENANCE" 20 21 // ConsensusTypeSolo identifies the solo consensus implementation. 22 ConsensusTypeSolo = "solo" 23 24 // ConsensusTypeKafka identifies the Kafka-based consensus implementation. 25 ConsensusTypeKafka = "kafka" 26 27 // ConsensusTypeEtcdRaft identifies the Raft-based consensus implementation. 28 ConsensusTypeEtcdRaft = "etcdraft" 29 30 // KafkaBrokersKey is the common.ConfigValue type key name for the KafkaBrokers message. 31 KafkaBrokersKey = "KafkaBrokers" 32 33 // ConsensusTypeKey is the common.ConfigValue type key name for the ConsensusType message. 34 ConsensusTypeKey = "ConsensusType" 35 36 // BatchSizeKey is the common.ConfigValue type key name for the BatchSize message. 37 BatchSizeKey = "BatchSize" 38 39 // BatchTimeoutKey is the common.ConfigValue type key name for the BatchTimeout message. 40 BatchTimeoutKey = "BatchTimeout" 41 42 // ChannelRestrictionsKey is the key name for the ChannelRestrictions message. 43 ChannelRestrictionsKey = "ChannelRestrictions" 44 ) 45 46 // ConsensusState defines the orderer mode of operation. 47 // Options: `ConsensusStateNormal` and `ConsensusStateMaintenance` 48 type ConsensusState string 49 50 // BatchSize is the configuration affecting the size of batches. 51 type BatchSize struct { 52 // MaxMessageCount is the max message count. 53 MaxMessageCount uint32 54 // AbsoluteMaxBytes is the max block size (not including headers). 55 AbsoluteMaxBytes uint32 56 // PreferredMaxBytes is the preferred size of blocks. 57 PreferredMaxBytes uint32 58 } 59 60 // Kafka is a list of Kafka broker endpoints. 61 type Kafka struct { 62 // Brokers contains the addresses of *at least two* kafka brokers 63 // Must be in `IP:port` notation 64 Brokers []string 65 } 66 67 // EtcdRaft is serialized and set as the value of ConsensusType.Metadata in 68 // a channel configuration when the ConsensusType.Type is set to "etcdraft". 69 type EtcdRaft struct { 70 Consenters []Consenter 71 Options EtcdRaftOptions 72 } 73 74 // EtcdRaftOptions to be specified for all the etcd/raft nodes. 75 // These can be modified on a per-channel basis. 76 type EtcdRaftOptions struct { 77 TickInterval string 78 ElectionTick uint32 79 HeartbeatTick uint32 80 MaxInflightBlocks uint32 81 // Take snapshot when cumulative data exceeds certain size in bytes. 82 SnapshotIntervalSize uint32 83 } 84 85 // Consenter represents a consenting node (i.e. replica). 86 type Consenter struct { 87 Address EtcdAddress 88 ClientTLSCert *x509.Certificate 89 ServerTLSCert *x509.Certificate 90 } 91 92 // EtcdAddress contains the hostname and port for an endpoint. 93 type EtcdAddress struct { 94 Host string 95 Port int 96 }