github.com/yimialmonte/fabric@v2.1.1+incompatible/integration/nwo/fabricconfig/core.go (about)

     1  /*
     2  Copyright IBM Corp. 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  	ExternalEndpoint           string          `yaml:"externalEndpoint,omitempty"`
    97  	Election                   *GossipElection `yaml:"election,omitempty"`
    98  	PvtData                    *GossipPvtData  `yaml:"pvtData,omitempty"`
    99  	State                      *GossipState    `yaml:"state,omitempty"`
   100  }
   101  
   102  type GossipElection struct {
   103  	StartupGracePeriod       time.Duration `yaml:"startupGracePeriod,omitempty"`
   104  	MembershipSampleInterval time.Duration `yaml:"membershipSampleInterval,omitempty"`
   105  	LeaderAliveThreshold     time.Duration `yaml:"leaderAliveThreshold,omitempty"`
   106  	LeaderElectionDuration   time.Duration `yaml:"leaderElectionDuration,omitempty"`
   107  }
   108  
   109  type GossipPvtData struct {
   110  	PullRetryThreshold                         time.Duration                   `yaml:"pullRetryThreshold,omitempty"`
   111  	TransientstoreMaxBlockRetention            int                             `yaml:"transientstoreMaxBlockRetention,omitempty"`
   112  	PushAckTimeout                             time.Duration                   `yaml:"pushAckTimeout,omitempty"`
   113  	BtlPullMargin                              int                             `yaml:"btlPullMargin,omitempty"`
   114  	ReconcileBatchSize                         int                             `yaml:"reconcileBatchSize,omitempty"`
   115  	ReconcileSleepInterval                     time.Duration                   `yaml:"reconcileSleepInterval,omitempty"`
   116  	ReconciliationEnabled                      bool                            `yaml:"reconciliationEnabled"`
   117  	SkipPullingInvalidTransactionsDuringCommit bool                            `yaml:"skipPullingInvalidTransactionsDuringCommit"`
   118  	ImplicitCollDisseminationPolicy            ImplicitCollDisseminationPolicy `yaml:"implicitCollectionDisseminationPolicy"`
   119  }
   120  
   121  type ImplicitCollDisseminationPolicy struct {
   122  	RequiredPeerCount int `yaml:"requiredPeerCount,omitempty"`
   123  	// do not tag omitempty in order to override MaxPeerCount default with 0
   124  	MaxPeerCount int `yaml:"maxPeerCount"`
   125  }
   126  
   127  type GossipState struct {
   128  	Enabled         bool          `yaml:"enabled"`
   129  	CheckInterval   time.Duration `yaml:"checkInterval,omitempty"`
   130  	ResponseTimeout time.Duration `yaml:"responseTimeout,omitempty"`
   131  	BatchSize       int           `yaml:"batchSize,omitempty"`
   132  	BlockBufferSize int           `yaml:"blockBufferSize,omitempty"`
   133  	MaxRetries      int           `yaml:"maxRetries,omitempty"`
   134  }
   135  
   136  type Events struct {
   137  	Address    string        `yaml:"address,omitempty"`
   138  	Buffersize int           `yaml:"buffersize,omitempty"`
   139  	Timeout    time.Duration `yaml:"timeout,omitempty"`
   140  	Timewindow time.Duration `yaml:"timewindow,omitempty"`
   141  	Keepalive  *Keepalive    `yaml:"keepalive,omitempty"`
   142  }
   143  
   144  type TLS struct {
   145  	Enabled            bool      `yaml:"enabled"`
   146  	ClientAuthRequired bool      `yaml:"clientAuthRequired"`
   147  	CA                 *FileRef  `yaml:"ca,omitempty"`
   148  	Cert               *FileRef  `yaml:"cert,omitempty"`
   149  	Key                *FileRef  `yaml:"key,omitempty"`
   150  	RootCert           *FileRef  `yaml:"rootcert,omitempty"`
   151  	ClientRootCAs      *FilesRef `yaml:"clientRootCAs,omitempty"`
   152  	ClientKey          *FileRef  `yaml:"clientKey,omitempty"`
   153  	ClientCert         *FileRef  `yaml:"clientCert,omitempty"`
   154  }
   155  
   156  type FileRef struct {
   157  	File string `yaml:"file,omitempty"`
   158  }
   159  
   160  type FilesRef struct {
   161  	Files []string `yaml:"files,omitempty"`
   162  }
   163  
   164  type Authentication struct {
   165  	Timewindow time.Duration `yaml:"timewindow,omitempty"`
   166  }
   167  
   168  type BCCSP struct {
   169  	Default string            `yaml:"Default,omitempty"`
   170  	SW      *SoftwareProvider `yaml:"SW,omitempty"`
   171  }
   172  
   173  type SoftwareProvider struct {
   174  	Hash     string `yaml:"Hash,omitempty"`
   175  	Security int    `yaml:"Security,omitempty"`
   176  }
   177  
   178  type DeliveryClient struct {
   179  	ReconnectTotalTimeThreshold time.Duration      `yaml:"reconnectTotalTimeThreshold,omitempty"`
   180  	AddressOverrides            []*AddressOverride `yaml:"addressOverrides,omitempty"`
   181  }
   182  
   183  type AddressOverride struct {
   184  	From        string `yaml:"from"`
   185  	To          string `yaml:"to"`
   186  	CACertsFile string `yaml:"caCertsFile"`
   187  }
   188  
   189  type Service struct {
   190  	Enabled       bool   `yaml:"enabled"`
   191  	ListenAddress string `yaml:"listenAddress,omitempty"`
   192  }
   193  
   194  type Handlers struct {
   195  	AuthFilters []Handler  `yaml:"authFilters,omitempty"`
   196  	Decorators  []Handler  `yaml:"decorators,omitempty"`
   197  	Endorsers   HandlerMap `yaml:"endorsers,omitempty"`
   198  	Validators  HandlerMap `yaml:"validators,omitempty"`
   199  }
   200  
   201  type Handler struct {
   202  	Name    string `yaml:"name,omitempty"`
   203  	Library string `yaml:"library,omitempty"`
   204  }
   205  
   206  type HandlerMap map[string]Handler
   207  
   208  type Discovery struct {
   209  	Enabled                      bool    `yaml:"enabled"`
   210  	AuthCacheEnabled             bool    `yaml:"authCacheEnabled"`
   211  	AuthCacheMaxSize             int     `yaml:"authCacheMaxSize,omitempty"`
   212  	AuthCachePurgeRetentionRatio float64 `yaml:"authCachePurgeRetentionRatio"`
   213  	OrgMembersAllowedAccess      bool    `yaml:"orgMembersAllowedAccess"`
   214  }
   215  
   216  type Limits struct {
   217  	Concurrency *Concurrency `yaml:"concurrency,omitempty"`
   218  }
   219  
   220  type Concurrency struct {
   221  	EndorserService int `yaml:"endorserService,omitempty"`
   222  	DeliverService  int `yaml:"deliverService,omitempty"`
   223  }
   224  
   225  type VM struct {
   226  	Endpoint string  `yaml:"endpoint,omitempty"`
   227  	Docker   *Docker `yaml:"docker,omitempty"`
   228  }
   229  
   230  type Docker struct {
   231  	TLS          *TLS               `yaml:"tls,omitempty"`
   232  	AttachStdout bool               `yaml:"attachStdout"`
   233  	HostConfig   *docker.HostConfig `yaml:"hostConfig,omitempty"`
   234  }
   235  
   236  type Chaincode struct {
   237  	Builder          string            `yaml:"builder,omitempty"`
   238  	Pull             bool              `yaml:"pull"`
   239  	Golang           *Golang           `yaml:"golang,omitempty"`
   240  	Java             *Java             `yaml:"java,omitempty"`
   241  	Node             *Node             `yaml:"node,omitempty"`
   242  	InstallTimeout   time.Duration     `yaml:"installTimeout,omitempty"`
   243  	StartupTimeout   time.Duration     `yaml:"startupTimeout,omitempty"`
   244  	ExecuteTimeout   time.Duration     `yaml:"executeTimeout,omitempty"`
   245  	Mode             string            `yaml:"mode,omitempty"`
   246  	Keepalive        int               `yaml:"keepalive,omitempty"`
   247  	System           SystemFlags       `yaml:"system,omitempty"`
   248  	Logging          *Logging          `yaml:"logging,omitempty"`
   249  	ExternalBuilders []ExternalBuilder `yaml:"externalBuilders"`
   250  
   251  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   252  }
   253  
   254  type Golang struct {
   255  	Runtime     string `yaml:"runtime,omitempty"`
   256  	DynamicLink bool   `yaml:"dynamicLink"`
   257  
   258  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   259  }
   260  
   261  type Java struct {
   262  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   263  }
   264  
   265  type Node struct {
   266  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   267  }
   268  
   269  type ExternalBuilder struct {
   270  	EnvironmentWhitelist []string `yaml:"environmentWhitelist,omitempty"`
   271  	Name                 string   `yaml:"name,omitempty"`
   272  	Path                 string   `yaml:"path,omitempty"`
   273  }
   274  
   275  type SystemFlags struct {
   276  	NEWLIFECYCLE string `yaml:"_lifecycle,omitempty"`
   277  	CSCC         string `yaml:"cscc,omitempty"`
   278  	LSCC         string `yaml:"lscc,omitempty"`
   279  	ESCC         string `yaml:"escc,omitempty"`
   280  	VSCC         string `yaml:"vscc,omitempty"`
   281  	QSCC         string `yaml:"qscc,omitempty"`
   282  }
   283  
   284  type Ledger struct {
   285  	// Blockchain - not sure if it's needed
   286  	State   *StateConfig   `yaml:"state,omitempty"`
   287  	History *HistoryConfig `yaml:"history,omitempty"`
   288  }
   289  
   290  type StateConfig struct {
   291  	StateDatabase string         `yaml:"stateDatabase,omitempty"`
   292  	CouchDBConfig *CouchDBConfig `yaml:"couchDBConfig,omitempty"`
   293  }
   294  
   295  type CouchDBConfig struct {
   296  	CouchDBAddress          string        `yaml:"couchDBAddress,omitempty"`
   297  	Username                string        `yaml:"username,omitempty"`
   298  	Password                string        `yaml:"password,omitempty"`
   299  	MaxRetries              int           `yaml:"maxRetries,omitempty"`
   300  	MaxRetriesOnStartup     int           `yaml:"maxRetriesOnStartup,omitempty"`
   301  	RequestTimeout          time.Duration `yaml:"requestTimeout,omitempty"`
   302  	QueryLimit              int           `yaml:"queryLimit,omitempty"`
   303  	MaxBatchUpdateSize      int           `yaml:"maxBatchUpdateSize,omitempty"`
   304  	WarmIndexesAfterNBlocks int           `yaml:"warmIndexesAfteNBlocks,omitempty"`
   305  }
   306  
   307  type HistoryConfig struct {
   308  	EnableHistoryDatabase bool `yaml:"enableHistoryDatabase"`
   309  }
   310  
   311  type Operations struct {
   312  	ListenAddress string `yaml:"listenAddress,omitempty"`
   313  	TLS           *TLS   `yaml:"tls"`
   314  }
   315  
   316  type Metrics struct {
   317  	Provider string  `yaml:"provider"`
   318  	Statsd   *Statsd `yaml:"statsd,omitempty"`
   319  }
   320  
   321  type Statsd struct {
   322  	Network       string        `yaml:"network,omitempty"`
   323  	Address       string        `yaml:"address,omitempty"`
   324  	WriteInterval time.Duration `yaml:"writeInterval,omitempty"`
   325  	Prefix        string        `yaml:"prefix,omitempty"`
   326  }