github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/integration/nwo/fabricconfig/core.go (about) 1 /* 2 Copyright hechain. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package fabricconfig 8 9 import ( 10 "time" 11 12 docker "github.com/fsouza/go-dockerclient" 13 ) 14 15 type Core struct { 16 Logging *Logging `yaml:"logging,omitempty"` 17 Peer *Peer `yaml:"peer,omitempty"` 18 VM *VM `yaml:"vm,omitempty"` 19 Chaincode *Chaincode `yaml:"chaincode,omitempty"` 20 Ledger *Ledger `yaml:"ledger,omitempty"` 21 Operations *Operations `yaml:"operations,omitempty"` 22 Metrics *Metrics `yaml:"metrics,omitempty"` 23 } 24 25 type Logging struct { 26 Format string `yaml:"format,omitempty"` 27 28 ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` 29 } 30 31 type Peer struct { 32 ID string `yaml:"id,omitempty"` 33 NetworkID string `yaml:"networkId,omitempty"` 34 ListenAddress string `yaml:"listenAddress,omitempty"` 35 ChaincodeListenAddress string `yaml:"ChaincodeListenAddress,omitempty"` 36 ChaincodeAddress string `yaml:"chaincodeAddress,omitempty"` 37 Address string `yaml:"address,omitempty"` 38 AddressAutoDetect bool `yaml:"addressAutoDetect"` 39 Keepalive *Keepalive `yaml:"keepalive,omitempty"` 40 Gossip *Gossip `yaml:"gossip,omitempty"` 41 Events *Events `yaml:"events,omitempty"` 42 TLS *TLS `yaml:"tls,omitempty"` 43 Authentication *Authentication `yaml:"authentication,omitempty"` 44 FileSystemPath string `yaml:"fileSystemPath,omitempty"` 45 BCCSP *BCCSP `yaml:"BCCSP,omitempty"` 46 MSPConfigPath string `yaml:"mspConfigPath,omitempty"` 47 LocalMSPID string `yaml:"localMspId,omitempty"` 48 Deliveryclient *DeliveryClient `yaml:"deliveryclient,omitempty"` 49 LocalMspType string `yaml:"localMspType,omitempty"` 50 Handlers *Handlers `yaml:"handlers,omitempty"` 51 ValidatorPoolSize int `yaml:"validatorPoolSize,omitempty"` 52 Discovery *Discovery `yaml:"discovery,omitempty"` 53 Limits *Limits `yaml:"limits,omitempty"` 54 55 ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` 56 } 57 58 type Keepalive struct { 59 MinInterval time.Duration `yaml:"minInterval,omitempty"` 60 Client *ClientKeepalive `yaml:"client,omitempty"` 61 DeliveryClient *ClientKeepalive `yaml:"deliveryClient,omitempty"` 62 } 63 64 type ClientKeepalive struct { 65 Interval time.Duration `yaml:"interval,omitempty"` 66 Timeout time.Duration `yaml:"timeout,omitempty"` 67 } 68 69 type Gossip struct { 70 Bootstrap string `yaml:"bootstrap,omitempty"` 71 UseLeaderElection bool `yaml:"useLeaderElection"` 72 OrgLeader bool `yaml:"orgLeader"` 73 MembershipTrackerInterval time.Duration `yaml:"membershipTrackerInterval,omitempty"` 74 Endpoint string `yaml:"endpoint,omitempty"` 75 MaxBlockCountToStore int `yaml:"maxBlockCountToStore,omitempty"` 76 MaxPropagationBurstLatency time.Duration `yaml:"maxPropagationBurstLatency,omitempty"` 77 MaxPropagationBurstSize int `yaml:"maxPropagationBurstSize,omitempty"` 78 PropagateIterations int `yaml:"propagateIterations,omitempty"` 79 PropagatePeerNum int `yaml:"propagatePeerNum,omitempty"` 80 PullInterval time.Duration `yaml:"pullInterval,omitempty"` 81 PullPeerNum int `yaml:"pullPeerNum,omitempty"` 82 RequestStateInfoInterval time.Duration `yaml:"requestStateInfoInterval,omitempty"` 83 PublishStateInfoInterval time.Duration `yaml:"publishStateInfoInterval,omitempty"` 84 StateInfoRetentionInterval time.Duration `yaml:"stateInfoRetentionInterval,omitempty"` 85 PublishCertPeriod time.Duration `yaml:"publishCertPeriod,omitempty"` 86 DialTimeout time.Duration `yaml:"dialTimeout,omitempty"` 87 ConnTimeout time.Duration `yaml:"connTimeout,omitempty"` 88 RecvBuffSize int `yaml:"recvBuffSize,omitempty"` 89 SendBuffSize int `yaml:"sendBuffSize,omitempty"` 90 DigestWaitTime time.Duration `yaml:"digestWaitTime,omitempty"` 91 RequestWaitTime time.Duration `yaml:"requestWaitTime,omitempty"` 92 ResponseWaitTime time.Duration `yaml:"responseWaitTime,omitempty"` 93 AliveTimeInterval time.Duration `yaml:"aliveTimeInterval,omitempty"` 94 AliveExpirationTimeout time.Duration `yaml:"aliveExpirationTimeout,omitempty"` 95 ReconnectInterval time.Duration `yaml:"reconnectInterval,omitempty"` 96 MsgExpirationFactor int `yaml:"msgExpirationFactor,omitempty"` 97 MaxConnectionAttempts int `yaml:"maxConnectionAttempts,omitempty"` 98 ExternalEndpoint string `yaml:"externalEndpoint,omitempty"` 99 Election *GossipElection `yaml:"election,omitempty"` 100 PvtData *GossipPvtData `yaml:"pvtData,omitempty"` 101 State *GossipState `yaml:"state,omitempty"` 102 } 103 104 type GossipElection struct { 105 StartupGracePeriod time.Duration `yaml:"startupGracePeriod,omitempty"` 106 MembershipSampleInterval time.Duration `yaml:"membershipSampleInterval,omitempty"` 107 LeaderAliveThreshold time.Duration `yaml:"leaderAliveThreshold,omitempty"` 108 LeaderElectionDuration time.Duration `yaml:"leaderElectionDuration,omitempty"` 109 } 110 111 type GossipPvtData struct { 112 PullRetryThreshold time.Duration `yaml:"pullRetryThreshold,omitempty"` 113 TransientstoreMaxBlockRetention int `yaml:"transientstoreMaxBlockRetention,omitempty"` 114 PushAckTimeout time.Duration `yaml:"pushAckTimeout,omitempty"` 115 BtlPullMargin int `yaml:"btlPullMargin,omitempty"` 116 ReconcileBatchSize int `yaml:"reconcileBatchSize,omitempty"` 117 ReconcileSleepInterval time.Duration `yaml:"reconcileSleepInterval,omitempty"` 118 ReconciliationEnabled bool `yaml:"reconciliationEnabled"` 119 SkipPullingInvalidTransactionsDuringCommit bool `yaml:"skipPullingInvalidTransactionsDuringCommit"` 120 ImplicitCollDisseminationPolicy ImplicitCollDisseminationPolicy `yaml:"implicitCollectionDisseminationPolicy"` 121 } 122 123 type ImplicitCollDisseminationPolicy struct { 124 RequiredPeerCount int `yaml:"requiredPeerCount,omitempty"` 125 // do not tag omitempty in order to override MaxPeerCount default with 0 126 MaxPeerCount int `yaml:"maxPeerCount"` 127 } 128 129 type GossipState struct { 130 Enabled bool `yaml:"enabled"` 131 CheckInterval time.Duration `yaml:"checkInterval,omitempty"` 132 ResponseTimeout time.Duration `yaml:"responseTimeout,omitempty"` 133 BatchSize int `yaml:"batchSize,omitempty"` 134 BlockBufferSize int `yaml:"blockBufferSize,omitempty"` 135 MaxRetries int `yaml:"maxRetries,omitempty"` 136 } 137 138 type Events struct { 139 Address string `yaml:"address,omitempty"` 140 Buffersize int `yaml:"buffersize,omitempty"` 141 Timeout time.Duration `yaml:"timeout,omitempty"` 142 Timewindow time.Duration `yaml:"timewindow,omitempty"` 143 Keepalive *Keepalive `yaml:"keepalive,omitempty"` 144 } 145 146 type TLS struct { 147 Enabled bool `yaml:"enabled"` 148 ClientAuthRequired bool `yaml:"clientAuthRequired"` 149 CA *FileRef `yaml:"ca,omitempty"` 150 Cert *FileRef `yaml:"cert,omitempty"` 151 Key *FileRef `yaml:"key,omitempty"` 152 RootCert *FileRef `yaml:"rootcert,omitempty"` 153 ClientRootCAs *FilesRef `yaml:"clientRootCAs,omitempty"` 154 ClientKey *FileRef `yaml:"clientKey,omitempty"` 155 ClientCert *FileRef `yaml:"clientCert,omitempty"` 156 } 157 158 type FileRef struct { 159 File string `yaml:"file,omitempty"` 160 } 161 162 type FilesRef struct { 163 Files []string `yaml:"files,omitempty"` 164 } 165 166 type Authentication struct { 167 Timewindow time.Duration `yaml:"timewindow,omitempty"` 168 } 169 170 type BCCSP struct { 171 Default string `yaml:"Default,omitempty"` 172 SW *SoftwareProvider `yaml:"SW,omitempty"` 173 PKCS11 *PKCS11 `yaml:"PKCS11,omitempty"` 174 } 175 176 type SoftwareProvider struct { 177 Hash string `yaml:"Hash,omitempty"` 178 Security int `yaml:"Security,omitempty"` 179 } 180 181 type PKCS11 struct { 182 Hash string `yaml:"Hash,omitempty"` 183 Security int `yaml:"Security,omitempty"` 184 Pin string `yaml:"Pin,omitempty"` 185 Label string `yaml:"Label,omitempty"` 186 Library string `yaml:"Library,omitempty"` 187 188 AltID string `yaml:"AltID,omitempty"` 189 KeyIDs []KeyIDMapping `yaml:"KeyIDs,omitempty"` 190 } 191 192 type KeyIDMapping struct { 193 SKI string `yaml:"SKI,omitempty"` 194 ID string `yaml:"ID,omitempty"` 195 } 196 197 type DeliveryClient struct { 198 ReconnectTotalTimeThreshold time.Duration `yaml:"reconnectTotalTimeThreshold,omitempty"` 199 AddressOverrides []*AddressOverride `yaml:"addressOverrides,omitempty"` 200 } 201 202 type AddressOverride struct { 203 From string `yaml:"from"` 204 To string `yaml:"to"` 205 CACertsFile string `yaml:"caCertsFile"` 206 } 207 208 type Service struct { 209 Enabled bool `yaml:"enabled"` 210 ListenAddress string `yaml:"listenAddress,omitempty"` 211 } 212 213 type Handlers struct { 214 AuthFilters []Handler `yaml:"authFilters,omitempty"` 215 Decorators []Handler `yaml:"decorators,omitempty"` 216 Endorsers HandlerMap `yaml:"endorsers,omitempty"` 217 Validators HandlerMap `yaml:"validators,omitempty"` 218 } 219 220 type Handler struct { 221 Name string `yaml:"name,omitempty"` 222 Library string `yaml:"library,omitempty"` 223 } 224 225 type HandlerMap map[string]Handler 226 227 type Discovery struct { 228 Enabled bool `yaml:"enabled"` 229 AuthCacheEnabled bool `yaml:"authCacheEnabled"` 230 AuthCacheMaxSize int `yaml:"authCacheMaxSize,omitempty"` 231 AuthCachePurgeRetentionRatio float64 `yaml:"authCachePurgeRetentionRatio"` 232 OrgMembersAllowedAccess bool `yaml:"orgMembersAllowedAccess"` 233 } 234 235 type Limits struct { 236 Concurrency *Concurrency `yaml:"concurrency,omitempty"` 237 } 238 239 type Concurrency struct { 240 EndorserService int `yaml:"endorserService,omitempty"` 241 DeliverService int `yaml:"deliverService,omitempty"` 242 } 243 244 type VM struct { 245 Endpoint string `yaml:"endpoint,omitempty"` 246 Docker *Docker `yaml:"docker,omitempty"` 247 } 248 249 type Docker struct { 250 TLS *TLS `yaml:"tls,omitempty"` 251 AttachStdout bool `yaml:"attachStdout"` 252 HostConfig *docker.HostConfig `yaml:"hostConfig,omitempty"` 253 } 254 255 type Chaincode struct { 256 Builder string `yaml:"builder,omitempty"` 257 Pull bool `yaml:"pull"` 258 Golang *Golang `yaml:"golang,omitempty"` 259 Java *Java `yaml:"java,omitempty"` 260 Node *Node `yaml:"node,omitempty"` 261 InstallTimeout time.Duration `yaml:"installTimeout,omitempty"` 262 StartupTimeout time.Duration `yaml:"startupTimeout,omitempty"` 263 ExecuteTimeout time.Duration `yaml:"executeTimeout,omitempty"` 264 Mode string `yaml:"mode,omitempty"` 265 Keepalive int `yaml:"keepalive,omitempty"` 266 System SystemFlags `yaml:"system,omitempty"` 267 Logging *Logging `yaml:"logging,omitempty"` 268 ExternalBuilders []ExternalBuilder `yaml:"externalBuilders"` 269 270 ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` 271 } 272 273 type Golang struct { 274 Runtime string `yaml:"runtime,omitempty"` 275 DynamicLink bool `yaml:"dynamicLink"` 276 277 ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` 278 } 279 280 type Java struct { 281 ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` 282 } 283 284 type Node struct { 285 ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` 286 } 287 288 type ExternalBuilder struct { 289 PropagateEnvironment []string `yaml:"propagateEnvironment,omitempty"` 290 Name string `yaml:"name,omitempty"` 291 Path string `yaml:"path,omitempty"` 292 } 293 294 type SystemFlags struct { 295 NEWLIFECYCLE string `yaml:"_lifecycle,omitempty"` 296 CSCC string `yaml:"cscc,omitempty"` 297 LSCC string `yaml:"lscc,omitempty"` 298 ESCC string `yaml:"escc,omitempty"` 299 VSCC string `yaml:"vscc,omitempty"` 300 QSCC string `yaml:"qscc,omitempty"` 301 } 302 303 type Ledger struct { 304 // Blockchain - not sure if it's needed 305 State *StateConfig `yaml:"state,omitempty"` 306 History *HistoryConfig `yaml:"history,omitempty"` 307 PvtdataStore *PvtdataStore `yaml:"pvtdataStore,omitempty"` 308 } 309 310 type StateConfig struct { 311 StateDatabase string `yaml:"stateDatabase,omitempty"` 312 CouchDBConfig *CouchDBConfig `yaml:"couchDBConfig,omitempty"` 313 } 314 315 type CouchDBConfig struct { 316 CouchDBAddress string `yaml:"couchDBAddress,omitempty"` 317 Username string `yaml:"username,omitempty"` 318 Password string `yaml:"password,omitempty"` 319 MaxRetries int `yaml:"maxRetries,omitempty"` 320 MaxRetriesOnStartup int `yaml:"maxRetriesOnStartup,omitempty"` 321 RequestTimeout time.Duration `yaml:"requestTimeout,omitempty"` 322 QueryLimit int `yaml:"queryLimit,omitempty"` 323 MaxBatchUpdateSize int `yaml:"maxBatchUpdateSize,omitempty"` 324 } 325 326 type HistoryConfig struct { 327 EnableHistoryDatabase bool `yaml:"enableHistoryDatabase"` 328 } 329 330 type PvtdataStore struct { 331 DeprioritizedDataReconcilerInterval time.Duration 332 } 333 334 type Operations struct { 335 ListenAddress string `yaml:"listenAddress,omitempty"` 336 TLS *TLS `yaml:"tls"` 337 } 338 339 type Metrics struct { 340 Provider string `yaml:"provider"` 341 Statsd *Statsd `yaml:"statsd,omitempty"` 342 } 343 344 type Statsd struct { 345 Network string `yaml:"network,omitempty"` 346 Address string `yaml:"address,omitempty"` 347 WriteInterval time.Duration `yaml:"writeInterval,omitempty"` 348 Prefix string `yaml:"prefix,omitempty"` 349 }