github.com/IBM-Blockchain/fabric-operator@v1.0.4/pkg/apis/peer/v1/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 v1 20 21 import ( 22 "github.com/IBM-Blockchain/fabric-operator/pkg/apis/common" 23 "github.com/docker/docker/api/types/container" 24 ) 25 26 type Core struct { 27 Peer Peer `json:"peer,omitempty"` 28 Chaincode Chaincode `json:"chaincode,omitempty"` 29 Operations Operations `json:"operations,omitempty"` 30 Metrics Metrics `json:"metrics,omitempty"` 31 VM VM `json:"vm,omitempty"` 32 Ledger Ledger `json:"ledger,omitempty"` 33 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 Keepalive KeepAlive `json:"keepalive,omitempty"` 47 Gossip Gossip `json:"gossip,omitempty"` 48 TLS TLS `json:"tls,omitempty"` 49 Authentication Authentication `json:"authentication,omitempty"` 50 FileSystemPath string `json:"fileSystemPath,omitempty"` 51 BCCSP *common.BCCSP `json:"BCCSP,omitempty"` 52 MspConfigPath string `json:"mspConfigPath,omitempty"` 53 LocalMspId string `json:"localMspId,omitempty"` 54 Client Client `json:"client,omitempty"` 55 DeliveryClient DeliveryClient `json:"deliveryclient,omitempty"` 56 LocalMspType string `json:"localMspType,omitempty"` 57 Profile Profile `json:"profile,omitempty"` 58 AdminService AdminService `json:"adminService,omitempty"` 59 Handlers HandlersConfig `json:"handlers,omitempty"` 60 ValidatorPoolSize int `json:"validatorPoolSize,omitempty"` 61 Discovery Discovery `json:"discovery,omitempty"` 62 Limits Limits `json:"limits,omitempty"` 63 } 64 65 type PluginMapping map[string]HandlerConfig 66 67 type HandlersConfig struct { 68 AuthFilters []HandlerConfig `json:"authFilters"` 69 Decorators []HandlerConfig `json:"decorators"` 70 Endorsers PluginMapping `json:"endorsers"` 71 Validators PluginMapping `json:"validators"` 72 } 73 74 type HandlerConfig struct { 75 Name string `json:"name"` 76 Library string `json:"library"` 77 } 78 79 type KeepAlive struct { 80 MinInterval common.Duration `json:"minInterval,omitempty"` 81 Client KeepAliveClient `json:"client,omitempty"` 82 DeliveryClient KeepAliveClient `json:"deliveryClient,omitempty"` 83 } 84 85 type KeepAliveClient struct { 86 Interval common.Duration `json:"interval,omitempty"` 87 Timeout common.Duration `json:"timeout,omitempty"` 88 } 89 90 type KeepAliveDeliveryClient struct { 91 Interval common.Duration `json:"interval,omitempty"` 92 Timeout common.Duration `json:"timeout,omitempty"` 93 } 94 95 type Gossip struct { 96 Bootstrap []string `json:"bootstrap,omitempty"` 97 UseLeaderElection *bool `json:"useLeaderElection,omitempty"` 98 OrgLeader *bool `json:"orgLeader,omitempty"` 99 MembershipTrackerInterval common.Duration `json:"membershipTrackerInterval,omitempty"` 100 Endpoint string `json:"endpoint,omitempty"` 101 MaxBlockCountToStore int `json:"maxBlockCountToStore,omitempty"` 102 MaxPropagationBurstLatency common.Duration `json:"maxPropagationBurstLatency,omitempty"` 103 MaxPropagationBurstSize int `json:"maxPropagationBurstSize,omitempty"` 104 PropagateIterations int `json:"propagateIterations,omitempty"` 105 PropagatePeerNum int `json:"propagatePeerNum,omitempty"` 106 PullInterval common.Duration `json:"pullInterval,omitempty"` 107 PullPeerNum int `json:"pullPeerNum,omitempty"` 108 RequestStateInfoInterval common.Duration `json:"requestStateInfoInterval,omitempty"` 109 PublishStateInfoInterval common.Duration `json:"publishStateInfoInterval,omitempty"` 110 StateInfoRetentionInterval common.Duration `json:"stateInfoRetentionInterval,omitempty"` 111 PublishCertPeriod common.Duration `json:"publishCertPeriod,omitempty"` 112 SkipBlockVerification *bool `json:"skipBlockVerification,omitempty"` 113 DialTimeout common.Duration `json:"dialTimeout,omitempty"` 114 ConnTimeout common.Duration `json:"connTimeout,omitempty"` 115 RecvBuffSize int `json:"recvBuffSize,omitempty"` 116 SendBuffSize int `json:"sendBuffSize,omitempty"` 117 DigestWaitTime common.Duration `json:"digestWaitTime,omitempty"` 118 RequestWaitTime common.Duration `json:"requestWaitTime,omitempty"` 119 ResponseWaitTime common.Duration `json:"responseWaitTime,omitempty"` 120 AliveTimeInterval common.Duration `json:"aliveTimeInterval,omitempty"` 121 AliveExpirationTimeout common.Duration `json:"aliveExpirationTimeout,omitempty"` 122 ReconnectInterval common.Duration `json:"reconnectInterval,omitempty"` 123 ExternalEndpoint string `json:"externalEndpoint,omitempty"` 124 Election Election `json:"election,omitempty"` 125 PvtData PVTData `json:"pvtData,omitempty"` 126 State State `json:"state,omitempty"` 127 MaxConnectionAttempts int `json:"maxConnectionAttempts,omitempty"` 128 MsgExpirationFactor int `json:"msgExpirationFactor,omitempty"` 129 } 130 131 type Election struct { 132 StartupGracePeriod common.Duration `json:"startupGracePeriod,omitempty"` 133 MembershipSampleInterval common.Duration `json:"membershipSampleInterval,omitempty"` 134 LeaderElectionDuration common.Duration `json:"leaderElectionDuration,omitempty"` 135 LeaderAliveThreshold common.Duration `json:"leaderAliveThreshold,omitempty"` 136 } 137 138 type PVTData struct { 139 PullRetryThreshold common.Duration `json:"pullRetryThreshold,omitempty"` 140 TransientstoreMaxBlockRetention int `json:"transientstoreMaxBlockRetention,omitempty"` 141 PushAckTimeout common.Duration `json:"pushAckTimeout,omitempty"` 142 BtlPullMargin int `json:"btlPullMargin,omitempty"` 143 ReconcileBatchSize int `json:"reconcileBatchSize,omitempty"` 144 ReconcileSleepInterval common.Duration `json:"reconcileSleepInterval,omitempty"` 145 ReconciliationEnabled *bool `json:"reconciliationEnabled,omitempty"` 146 SkipPullingInvalidTransactionsDuringCommit *bool `json:"skipPullingInvalidTransactionsDuringCommit,omitempty"` 147 } 148 149 type State struct { 150 Enabled *bool `json:"enabled,omitempty"` 151 CheckInterval common.Duration `json:"checkInterval,omitempty"` 152 ResponseTimeout common.Duration `json:"responseTimeout,omitempty"` 153 BatchSize int `json:"batchSize,omitempty"` 154 BlockBufferSize int `json:"blockBufferSize,omitempty"` 155 MaxRetries int `json:"maxRetries,omitempty"` 156 } 157 158 type TLS struct { 159 Enabled *bool `json:"enabled,omitempty"` 160 ClientAuthRequired *bool `json:"clientAuthRequired,omitempty"` 161 Cert Cert `json:"cert,omitempty"` 162 Key Key `json:"key,omitempty"` 163 RootCert Cert `json:"rootCert,omitempty"` 164 ClientRootCAs ClientRootCAs `json:"clientRootCas,omitempty"` 165 ClientKey Key `json:"clientKey,omitempty"` 166 ClientCert Cert `json:"clientCert,omitempty"` 167 } 168 169 type Cert struct { 170 File string `json:"file,omitempty"` 171 } 172 173 type Key struct { 174 File string `json:"file,omitempty"` 175 } 176 177 type ClientRootCAs struct { 178 Files []string `json:"files,omitempty"` 179 } 180 181 type Authentication struct { 182 Timewindow common.Duration `json:"timewindow,omitempty"` 183 } 184 185 type Client struct { 186 ConnTimeout common.Duration `json:"connTimeout,omitempty"` 187 } 188 189 type AddressOverride struct { 190 From string `json:"from"` 191 To string `json:"to"` 192 CACertsFile string `json:"caCertsFile"` 193 } 194 195 type DeliveryClient struct { 196 ReconnectTotalTimeThreshold common.Duration `json:"reconnectTotalTimeThreshold,omitempty"` 197 ConnTimeout common.Duration `json:"connTimeout,omitempty"` 198 ReConnectBackoffThreshold common.Duration `json:"reConnectBackoffThreshold,omitempty"` 199 AddressOverrides []AddressOverride `json:"addressOverrides,omitempty"` 200 } 201 202 type Profile struct { 203 Enabled *bool `json:"enabled,omitempty"` 204 ListenAddress string `json:"listenAddress,omitempty"` 205 } 206 207 type AdminService struct { 208 ListenAddress string `json:"listenAddress,omitempty"` 209 } 210 211 type Discovery struct { 212 Enabled *bool `json:"enabled,omitempty"` 213 AuthCacheEnabled *bool `json:"authCacheEnabled,omitempty"` 214 AuthCacheMaxSize int `json:"authCacheMaxSize,omitempty"` 215 AuthCachePurgeRetentionRatio float64 `json:"authCachePurgeRetentionRatio,omitempty"` 216 OrgMembersAllowedAccess *bool `json:"orgMembersAllowedAccess,omitempty"` 217 } 218 219 type Limits struct { 220 Concurrency Concurrency `json:"concurrency,omitempty"` 221 } 222 223 type Concurrency struct { 224 Qscc int `json:"qscc,omitempty"` 225 } 226 227 // Operations configures the operations endpont for the peer. 228 type Operations struct { 229 ListenAddress string `json:"listenAddress,omitempty"` 230 TLS OperationsTLS `json:"tls,omitempty"` 231 } 232 233 // TLS contains configuration for TLS connections. 234 type OperationsTLS struct { 235 Enabled *bool `json:"enabled,omitempty"` 236 PrivateKey File `json:"key,omitempty"` 237 Certificate File `json:"cert,omitempty"` 238 ClientAuthRequired *bool `json:"clientAuthRequired,omitempty"` 239 ClientRootCAs Files `json:"clientRootCas,omitempty"` 240 } 241 242 type File struct { 243 File string `json:"file,omitempty"` 244 } 245 246 type Files struct { 247 Files []string `json:"files,omitempty"` 248 } 249 250 // Metrics confiures the metrics provider for the peer. 251 type Metrics struct { 252 Provider string `json:"provider,omitempty"` 253 Statsd Statsd `json:"statsd,omitempty"` 254 } 255 256 // Statsd provides the configuration required to emit statsd metrics from the peer. 257 type Statsd struct { 258 Network string `json:"network,omitempty"` 259 Address string `json:"address,omitempty"` 260 WriteInterval common.Duration `json:"writeInterval,omitempty"` 261 Prefix string `json:"prefix,omitempty"` 262 } 263 264 type Chaincode struct { 265 ID ID `json:"id,omitempty"` 266 Builder string `json:"builder,omitempty"` 267 Pull *bool `json:"pull.omitempty"` 268 Golang Golang `json:"golang,omitempty"` 269 Java Java `json:"java,omitempty"` 270 Node Node `json:"node,omitempty"` 271 StartupTimeout common.Duration `json:"startuptimeout,omitempty"` 272 ExecuteTimeout common.Duration `json:"executetimeout,omitempty"` 273 InstallTimeout common.Duration `json:"installTimeout,omitempty"` 274 Mode string `json:"mode,omitempty"` 275 KeepAlive common.Duration `json:"keepalive,omitempty"` 276 System map[string]string `json:"system,omitempty"` 277 Logging Logging `json:"logging,omitempty"` 278 SystemPlugins []SystemPlugin `json:"systemPlugins,omitempty"` 279 } 280 281 type SystemPlugin struct { 282 Enabled *bool `json:"enabled"` 283 Name string `json:"name"` 284 Path string `json:"path"` 285 InvokableExternal *bool `json:"invokableExternal"` 286 InvokableCC2CC *bool `json:"invokableCC2CC"` 287 } 288 289 type ID struct { 290 Path string `json:"path,omitempty"` 291 Name string `json:"name,omitempty"` 292 } 293 294 type Golang struct { 295 Runtime string `json:"runtime,omitempty"` 296 DynamicLink *bool `json:"dynamicLink,omitempty"` 297 } 298 299 type Java struct { 300 Runtime string `json:"runtime,omitempty"` 301 } 302 303 type Node struct { 304 Runtime string `json:"runtime,omitempty"` 305 } 306 307 type Logging struct { 308 Level string `json:"level,omitempty"` 309 Shim string `json:"shim,omitempty"` 310 Format string `json:"format,omitempty"` 311 } 312 313 type VM struct { 314 Endpoint string `json:"endpoint,omitempty"` 315 Docker VMDocker `json:"docker,omitempty"` 316 } 317 318 type VMDocker struct { 319 TLS DockerTLS `json:"tls,omitempty"` 320 AttachStdout *bool `json:"attachStdout,omitempty"` 321 HostConfig container.HostConfig `json:"hostConfig,omitempty"` 322 } 323 324 type DockerTLS struct { 325 Enabled *bool `json:"enabled,omitempty"` 326 CA File `json:"ca,omitempty"` 327 Cert File `json:"cert,omitempty"` 328 Key File `json:"key,omitempty"` 329 } 330 331 type Ledger struct { 332 State LedgerState `json:"state,omitempty"` 333 History LedgerHistory `json:"history,omitempty"` 334 } 335 336 type LedgerState struct { 337 StateDatabase string `json:"stateDatabase,omitempty"` 338 TotalQueryLimit int `json:"totalQueryLimit,omitempty"` 339 CouchdbConfig CouchdbConfig `json:"couchDBConfig,omitempty"` 340 } 341 342 type CouchdbConfig struct { 343 CouchDBAddress string `json:"couchDBAddress,omitempty"` 344 Username string `json:"username,omitempty"` 345 Password string `json:"password,omitempty"` 346 MaxRetries int `json:"maxRetries,omitempty"` 347 MaxRetriesOnStartup int `json:"maxRetriesOnStartup,omitempty"` 348 RequestTimeout common.Duration `json:"requestTimeout,omitempty"` 349 QueryLimit int `json:"internalQueryLimit,omitempty"` 350 MaxBatchUpdateSize int `json:"maxBatchUpdateSize,omitempty"` 351 WarmIndexesAfterNBlocks int `json:"warmIndexesAfterNBlocks,omitempty"` 352 CreateGlobalChangesDB *bool `json:"createGlobalChangesDB,omitempty"` 353 } 354 355 type LedgerHistory struct { 356 EnableHistoryDatabase *bool `json:"enableHistoryDatabase,omitempty"` 357 }