github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/apis/peer/v2/peer.go (about) 1 /* 2 * Copyright contributors to the Hyperledger Fabric Operator project 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at: 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package v2 20 21 import ( 22 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" 23 v1 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/peer/v1" 24 "github.com/IBM-Blockchain/fabric-operator/pkg/util" 25 ) 26 27 type Core struct { 28 Peer Peer `json:"peer,omitempty"` 29 Chaincode Chaincode `json:"chaincode,omitempty"` 30 Operations v1.Operations `json:"operations,omitempty"` 31 Metrics v1.Metrics `json:"metrics,omitempty"` 32 VM v1.VM `json:"vm,omitempty"` 33 Ledger Ledger `json:"ledger,omitempty"` 34 // Not Fabric - this is for deployment 35 MaxNameLength *int `json:"maxnamelength,omitempty"` 36 } 37 38 type Peer struct { 39 ID string `json:"id,omitempty"` 40 NetworkID string `json:"networkId,omitempty"` 41 ListenAddress string `json:"listenAddress,omitempty"` 42 ChaincodeListenAddress string `json:"chaincodeListenAddress,omitempty"` 43 ChaincodeAddress string `json:"chaincodeAddress,omitempty"` 44 Address string `json:"address,omitempty"` 45 AddressAutoDetect *bool `json:"addressAutoDetect,omitempty"` 46 Gateway Gateway `json:"gateway,omitempty"` 47 Keepalive KeepAlive `json:"keepalive,omitempty"` 48 Gossip Gossip `json:"gossip,omitempty"` 49 TLS v1.TLS `json:"tls,omitempty"` 50 Authentication v1.Authentication `json:"authentication,omitempty"` 51 FileSystemPath string `json:"fileSystemPath,omitempty"` 52 BCCSP *common.BCCSP `json:"BCCSP,omitempty"` 53 MspConfigPath string `json:"mspConfigPath,omitempty"` 54 LocalMspId string `json:"localMspId,omitempty"` 55 Client v1.Client `json:"client,omitempty"` 56 DeliveryClient v1.DeliveryClient `json:"deliveryclient,omitempty"` 57 LocalMspType string `json:"localMspType,omitempty"` 58 Profile v1.Profile `json:"profile,omitempty"` 59 AdminService v1.AdminService `json:"adminService,omitempty"` 60 Handlers v1.HandlersConfig `json:"handlers,omitempty"` 61 ValidatorPoolSize int `json:"validatorPoolSize,omitempty"` 62 Discovery v1.Discovery `json:"discovery,omitempty"` 63 Limits Limits `json:"limits,omitempty"` 64 } 65 66 type Gossip struct { 67 Bootstrap []string `json:"bootstrap,omitempty"` 68 UseLeaderElection *bool `json:"useLeaderElection,omitempty"` 69 OrgLeader *bool `json:"orgLeader,omitempty"` 70 MembershipTrackerInterval common.Duration `json:"membershipTrackerInterval,omitempty"` 71 Endpoint string `json:"endpoint,omitempty"` 72 MaxBlockCountToStore int `json:"maxBlockCountToStore,omitempty"` 73 MaxPropagationBurstLatency common.Duration `json:"maxPropagationBurstLatency,omitempty"` 74 MaxPropagationBurstSize int `json:"maxPropagationBurstSize,omitempty"` 75 PropagateIterations int `json:"propagateIterations,omitempty"` 76 PropagatePeerNum int `json:"propagatePeerNum,omitempty"` 77 PullInterval common.Duration `json:"pullInterval,omitempty"` 78 PullPeerNum int `json:"pullPeerNum,omitempty"` 79 RequestStateInfoInterval common.Duration `json:"requestStateInfoInterval,omitempty"` 80 PublishStateInfoInterval common.Duration `json:"publishStateInfoInterval,omitempty"` 81 StateInfoRetentionInterval common.Duration `json:"stateInfoRetentionInterval,omitempty"` 82 PublishCertPeriod common.Duration `json:"publishCertPeriod,omitempty"` 83 SkipBlockVerification *bool `json:"skipBlockVerification,omitempty"` 84 DialTimeout common.Duration `json:"dialTimeout,omitempty"` 85 ConnTimeout common.Duration `json:"connTimeout,omitempty"` 86 RecvBuffSize int `json:"recvBuffSize,omitempty"` 87 SendBuffSize int `json:"sendBuffSize,omitempty"` 88 DigestWaitTime common.Duration `json:"digestWaitTime,omitempty"` 89 RequestWaitTime common.Duration `json:"requestWaitTime,omitempty"` 90 ResponseWaitTime common.Duration `json:"responseWaitTime,omitempty"` 91 AliveTimeInterval common.Duration `json:"aliveTimeInterval,omitempty"` 92 AliveExpirationTimeout common.Duration `json:"aliveExpirationTimeout,omitempty"` 93 ReconnectInterval common.Duration `json:"reconnectInterval,omitempty"` 94 ExternalEndpoint string `json:"externalEndpoint,omitempty"` 95 Election v1.Election `json:"election,omitempty"` 96 PvtData PVTData `json:"pvtData,omitempty"` 97 State v1.State `json:"state,omitempty"` 98 MaxConnectionAttempts int `json:"maxConnectionAttempts,omitempty"` 99 MsgExpirationFactor int `json:"msgExpirationFactor,omitempty"` 100 } 101 102 type PVTData struct { 103 PullRetryThreshold common.Duration `json:"pullRetryThreshold,omitempty"` 104 TransientstoreMaxBlockRetention int `json:"transientstoreMaxBlockRetention,omitempty"` 105 PushAckTimeout common.Duration `json:"pushAckTimeout,omitempty"` 106 BtlPullMargin int `json:"btlPullMargin,omitempty"` 107 ReconcileBatchSize int `json:"reconcileBatchSize,omitempty"` 108 ReconcileSleepInterval common.Duration `json:"reconcileSleepInterval,omitempty"` 109 ReconciliationEnabled *bool `json:"reconciliationEnabled,omitempty"` 110 SkipPullingInvalidTransactionsDuringCommit *bool `json:"skipPullingInvalidTransactionsDuringCommit,omitempty"` 111 ImplicitCollectionDisseminationPolicy ImplicitCollectionDisseminationPolicy `json:"implicitCollectionDisseminationPolicy,omitempty"` 112 } 113 114 type AddressOverride struct { 115 From string `json:"from"` 116 To string `json:"to"` 117 CACertsFile string `json:"caCertsFile"` 118 certBytes []byte 119 } 120 121 type Limits struct { 122 Concurrency Concurrency `json:"concurrency,omitempty"` 123 } 124 125 type Concurrency struct { 126 EndorserService int `json:"endorserService,omitempty"` 127 DeliverService int `json:"deliverService,omitempty"` 128 GatewayService int `json:"gatewayService,omitempty"` 129 } 130 131 type ImplicitCollectionDisseminationPolicy struct { 132 RequiredPeerCount int `json:"requiredPeerCount,omitempty"` 133 MaxPeerCount int `json:"maxPeerCount,omitempty"` 134 } 135 136 type Chaincode struct { 137 ID v1.ID `json:"id,omitempty"` 138 Builder string `json:"builder,omitempty"` 139 Pull *bool `json:"pull,omitempty"` 140 Golang v1.Golang `json:"golang,omitempty"` 141 Java v1.Java `json:"java,omitempty"` 142 Node v1.Node `json:"node,omitempty"` 143 StartupTimeout common.Duration `json:"startuptimeout,omitempty"` 144 ExecuteTimeout common.Duration `json:"executetimeout,omitempty"` 145 Mode string `json:"mode,omitempty"` 146 KeepAlive common.Duration `json:"keepalive,omitempty"` 147 System map[string]string `json:"system,omitempty"` 148 Logging v1.Logging `json:"logging,omitempty"` 149 ExternalBuilders []ExternalBuilder `json:"externalBuilders,omitempty"` 150 InstallTimeout common.Duration `json:"installTimeout,omitempty"` 151 } 152 153 type ExternalBuilder struct { 154 Path string `json:"path,omitempty"` 155 Name string `json:"name,omitempty"` 156 EnvironmentWhiteList []string `json:"environmentWhiteList,omitempty"` 157 PropogateEnvironment []string `json:"propagateEnvironment,omitempty"` 158 } 159 160 type Ledger struct { 161 State LedgerState `json:"state,omitempty"` 162 History v1.LedgerHistory `json:"history,omitempty"` 163 PvtDataStore PvtDataStore `json:"pvtdataStore,omitempty"` 164 } 165 166 type LedgerState struct { 167 StateDatabase string `json:"stateDatabase,omitempty"` 168 TotalQueryLimit int `json:"totalQueryLimit,omitempty"` 169 CouchdbConfig CouchdbConfig `json:"couchDBConfig,omitempty"` 170 SnapShots SnapShots `json:"SnapShots,omitempty"` 171 } 172 173 type CouchdbConfig struct { 174 CouchDBAddress string `json:"couchDBAddress,omitempty"` 175 Username string `json:"username,omitempty"` 176 Password string `json:"password,omitempty"` 177 MaxRetries int `json:"maxRetries,omitempty"` 178 MaxRetriesOnStartup int `json:"maxRetriesOnStartup,omitempty"` 179 RequestTimeout common.Duration `json:"requestTimeout,omitempty"` 180 QueryLimit int `json:"internalQueryLimit,omitempty"` 181 MaxBatchUpdateSize int `json:"maxBatchUpdateSize,omitempty"` 182 WarmIndexesAfterNBlocks int `json:"warmIndexesAfterNBlocks,omitempty"` 183 CreateGlobalChangesDB *bool `json:"createGlobalChangesDB,omitempty"` 184 CacheSize int `json:"cacheSize,omitempty"` 185 } 186 187 type SnapShots struct { 188 RootDir string `json:"rootDir,omitempty"` 189 } 190 191 type PvtDataStore struct { 192 CollElgProcMaxDbBatchSize int `json:"collElgProcMaxDbBatchSize,omitempty"` 193 CollElgProcDbBatchesInterval int `json:"collElgProcDbBatchesInterval,omitempty"` 194 DeprioritizedDataReconcilerInterval common.Duration `json:"deprioritizedDataReconcilerInterval,omitempty"` 195 } 196 197 type Gateway struct { 198 Enabled *bool `json:"enabled,omitempty"` 199 EndorsementTimeout common.Duration `json:"endorsementTimeout,omitempty"` 200 DialTimeout common.Duration `json:"dialTimeout,omitempty"` 201 } 202 203 type KeepAlive struct { 204 Interval common.Duration `json:"interval,omitempty"` 205 Timeout common.Duration `json:"timeout,omitempty"` 206 MinInterval common.Duration `json:"minInterval,omitempty"` 207 Client v1.KeepAliveClient `json:"client,omitempty"` 208 DeliveryClient v1.KeepAliveClient `json:"deliveryClient,omitempty"` 209 } 210 211 func (a *AddressOverride) CACertsFileToBytes() ([]byte, error) { 212 data, err := util.Base64ToBytes(a.CACertsFile) 213 if err != nil { 214 return nil, err 215 } 216 217 return data, nil 218 } 219 220 func (a *AddressOverride) GetCertBytes() []byte { 221 return a.certBytes 222 }