github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/common/types/channelinfo.go (about) 1 /* 2 Copyright hechain. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package types 8 9 // ErrorResponse carries the error response an HTTP request. 10 // This is marshaled into the body of the HTTP response. 11 type ErrorResponse struct { 12 Error string `json:"error"` 13 } 14 15 // ChannelList carries the response to an HTTP request to List all the channels. 16 // This is marshaled into the body of the HTTP response. 17 // swagger:model channelList 18 type ChannelList struct { 19 // The system channel info, nil if it doesn't exist. 20 SystemChannel *ChannelInfoShort `json:"systemChannel"` 21 // Application channels only, nil or empty if no channels defined. 22 Channels []ChannelInfoShort `json:"channels"` 23 } 24 25 // ChannelInfoShort carries a short info of a single channel. 26 type ChannelInfoShort struct { 27 // The channel name. 28 Name string `json:"name"` 29 // The channel relative URL (no Host:Port, only path), e.g.: "/participation/v1/channels/my-channel". 30 URL string `json:"url"` 31 } 32 33 // ConsensusRelation represents the relationship between the orderer and the channel's consensus cluster. 34 type ConsensusRelation string 35 36 const ( 37 // The orderer is a cluster consenter of a cluster consensus protocol (e.g. etcdraft) for a specific channel. 38 // That is, the orderer is in the consenters set of the channel. 39 ConsensusRelationConsenter ConsensusRelation = "consenter" 40 // The orderer is following a cluster consensus protocol by pulling blocks from other orderers. 41 // The orderer is NOT in the consenters set of the channel. 42 ConsensusRelationFollower ConsensusRelation = "follower" 43 // The orderer is NOT in the consenters set of the channel, and is just tracking (polling) the last config block 44 // of the channel in order to detect when it is added to the channel. 45 ConsensusRelationConfigTracker ConsensusRelation = "config-tracker" 46 // The orderer runs a non-cluster consensus type, solo or kafka. 47 ConsensusRelationOther ConsensusRelation = "other" 48 ) 49 50 // Status represents the degree by which the orderer had caught up with the rest of the cluster after joining the 51 // channel (either as a consenter or a follower). 52 type Status string 53 54 const ( 55 // The orderer is active in the channel's consensus protocol, or following the cluster, 56 // with block height > the join-block number. (Height is last block number +1). 57 StatusActive Status = "active" 58 // The orderer is catching up with the cluster by pulling blocks from other orderers, 59 // with block height <= the join-block number. 60 StatusOnBoarding Status = "onboarding" 61 // The orderer is not storing any blocks for this channel. 62 StatusInactive Status = "inactive" 63 // The last orderer operation against the channel failed. 64 StatusFailed Status = "failed" 65 ) 66 67 // ChannelInfo carries the response to an HTTP request to List a single channel. 68 // This is marshaled into the body of the HTTP response. 69 // swagger:model channelInfo 70 type ChannelInfo struct { 71 // The channel name. 72 Name string `json:"name"` 73 // The channel relative URL (no Host:Port, only path), e.g.: "/participation/v1/channels/my-channel". 74 URL string `json:"url"` 75 // Whether the orderer is a “consenter”, ”follower”, or "config-tracker" of 76 // the cluster for this channel. 77 // For non cluster consensus types (solo, kafka) it is "other". 78 // Possible values: “consenter”, ”follower”, "config-tracker", "other". 79 ConsensusRelation ConsensusRelation `json:"consensusRelation"` 80 // Whether the orderer is ”onboarding”, ”active”, or "inactive", for this channel. 81 // For non cluster consensus types (solo, kafka) it is "active". 82 // Possible values: “onboarding”, ”active”, "inactive". 83 Status Status `json:"status"` 84 // Current block height. 85 Height uint64 `json:"height"` 86 }