github.com/yous1230/fabric@v2.0.0-beta.0.20191224111736-74345bee6ac2+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  
    54  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
    55  }
    56  
    57  type Keepalive struct {
    58  	MinInterval    time.Duration    `yaml:"minInterval,omitempty"`
    59  	Client         *ClientKeepalive `yaml:"client,omitempty"`
    60  	DeliveryClient *ClientKeepalive `yaml:"deliveryClient,omitempty"`
    61  }
    62  
    63  type ClientKeepalive struct {
    64  	Interval time.Duration `yaml:"interval,omitempty"`
    65  	Timeout  time.Duration `yaml:"timeout,omitempty"`
    66  }
    67  
    68  type Gossip struct {
    69  	Bootstrap                  string          `yaml:"bootstrap,omitempty"`
    70  	UseLeaderElection          bool            `yaml:"useLeaderElection"`
    71  	OrgLeader                  bool            `yaml:"orgLeader"`
    72  	MembershipTrackerInterval  time.Duration   `yaml:"membershipTrackerInterval,omitempty"`
    73  	Endpoint                   string          `yaml:"endpoint,omitempty"`
    74  	MaxBlockCountToStore       int             `yaml:"maxBlockCountToStore,omitempty"`
    75  	MaxPropagationBurstLatency time.Duration   `yaml:"maxPropagationBurstLatency,omitempty"`
    76  	MaxPropagationBurstSize    int             `yaml:"maxPropagationBurstSize,omitempty"`
    77  	PropagateIterations        int             `yaml:"propagateIterations,omitempty"`
    78  	PropagatePeerNum           int             `yaml:"propagatePeerNum,omitempty"`
    79  	PullInterval               time.Duration   `yaml:"pullInterval,omitempty"`
    80  	PullPeerNum                int             `yaml:"pullPeerNum,omitempty"`
    81  	RequestStateInfoInterval   time.Duration   `yaml:"requestStateInfoInterval,omitempty"`
    82  	PublishStateInfoInterval   time.Duration   `yaml:"publishStateInfoInterval,omitempty"`
    83  	StateInfoRetentionInterval time.Duration   `yaml:"stateInfoRetentionInterval,omitempty"`
    84  	PublishCertPeriod          time.Duration   `yaml:"publishCertPeriod,omitempty"`
    85  	DialTimeout                time.Duration   `yaml:"dialTimeout,omitempty"`
    86  	ConnTimeout                time.Duration   `yaml:"connTimeout,omitempty"`
    87  	RecvBuffSize               int             `yaml:"recvBuffSize,omitempty"`
    88  	SendBuffSize               int             `yaml:"sendBuffSize,omitempty"`
    89  	DigestWaitTime             time.Duration   `yaml:"digestWaitTime,omitempty"`
    90  	RequestWaitTime            time.Duration   `yaml:"requestWaitTime,omitempty"`
    91  	ResponseWaitTime           time.Duration   `yaml:"responseWaitTime,omitempty"`
    92  	AliveTimeInterval          time.Duration   `yaml:"aliveTimeInterval,omitempty"`
    93  	AliveExpirationTimeout     time.Duration   `yaml:"aliveExpirationTimeout,omitempty"`
    94  	ReconnectInterval          time.Duration   `yaml:"reconnectInterval,omitempty"`
    95  	ExternalEndpoint           string          `yaml:"externalEndpoint,omitempty"`
    96  	Election                   *GossipElection `yaml:"election,omitempty"`
    97  	PvtData                    *GossipPvtData  `yaml:"pvtData,omitempty"`
    98  	State                      *GossipState    `yaml:"state,omitempty"`
    99  }
   100  
   101  type GossipElection struct {
   102  	StartupGracePeriod       time.Duration `yaml:"startupGracePeriod,omitempty"`
   103  	MembershipSampleInterval time.Duration `yaml:"membershipSampleInterval,omitempty"`
   104  	LeaderAliveThreshold     time.Duration `yaml:"leaderAliveThreshold,omitempty"`
   105  	LeaderElectionDuration   time.Duration `yaml:"leaderElectionDuration,omitempty"`
   106  }
   107  
   108  type GossipPvtData struct {
   109  	PullRetryThreshold                         time.Duration `yaml:"pullRetryThreshold,omitempty"`
   110  	TransientstoreMaxBlockRetention            int           `yaml:"transientstoreMaxBlockRetention,omitempty"`
   111  	PushAckTimeout                             time.Duration `yaml:"pushAckTimeout,omitempty"`
   112  	BtlPullMargin                              int           `yaml:"btlPullMargin,omitempty"`
   113  	ReconcileBatchSize                         int           `yaml:"reconcileBatchSize,omitempty"`
   114  	ReconcileSleepInterval                     time.Duration `yaml:"reconcileSleepInterval,omitempty"`
   115  	ReconciliationEnabled                      bool          `yaml:"reconciliationEnabled"`
   116  	SkipPullingInvalidTransactionsDuringCommit bool          `yaml:"skipPullingInvalidTransactionsDuringCommit"`
   117  }
   118  
   119  type GossipState struct {
   120  	Enabled         bool          `yaml:"enabled"`
   121  	CheckInterval   time.Duration `yaml:"checkInterval,omitempty"`
   122  	ResponseTimeout time.Duration `yaml:"responseTimeout,omitempty"`
   123  	BatchSize       int           `yaml:"batchSize,omitempty"`
   124  	BlockBufferSize int           `yaml:"blockBufferSize,omitempty"`
   125  	MaxRetries      int           `yaml:"maxRetries,omitempty"`
   126  }
   127  
   128  type Events struct {
   129  	Address    string        `yaml:"address,omitempty"`
   130  	Buffersize int           `yaml:"buffersize,omitempty"`
   131  	Timeout    time.Duration `yaml:"timeout,omitempty"`
   132  	Timewindow time.Duration `yaml:"timewindow,omitempty"`
   133  	Keepalive  *Keepalive    `yaml:"keepalive,omitempty"`
   134  }
   135  
   136  type TLS struct {
   137  	Enabled            bool      `yaml:"enabled"`
   138  	ClientAuthRequired bool      `yaml:"clientAuthRequired"`
   139  	CA                 *FileRef  `yaml:"ca,omitempty"`
   140  	Cert               *FileRef  `yaml:"cert,omitempty"`
   141  	Key                *FileRef  `yaml:"key,omitempty"`
   142  	RootCert           *FileRef  `yaml:"rootcert,omitempty"`
   143  	ClientRootCAs      *FilesRef `yaml:"clientRootCAs,omitempty"`
   144  	ClientKey          *FileRef  `yaml:"clientKey,omitempty"`
   145  	ClientCert         *FileRef  `yaml:"clientCert,omitempty"`
   146  }
   147  
   148  type FileRef struct {
   149  	File string `yaml:"file,omitempty"`
   150  }
   151  
   152  type FilesRef struct {
   153  	Files []string `yaml:"files,omitempty"`
   154  }
   155  
   156  type Authentication struct {
   157  	Timewindow time.Duration `yaml:"timewindow,omitempty"`
   158  }
   159  
   160  type BCCSP struct {
   161  	Default string            `yaml:"Default,omitempty"`
   162  	SW      *SoftwareProvider `yaml:"SW,omitempty"`
   163  }
   164  
   165  type SoftwareProvider struct {
   166  	Hash     string `yaml:"Hash,omitempty"`
   167  	Security int    `yaml:"Security,omitempty"`
   168  }
   169  
   170  type DeliveryClient struct {
   171  	ReconnectTotalTimeThreshold time.Duration      `yaml:"reconnectTotalTimeThreshold,omitempty"`
   172  	AddressOverrides            []*AddressOverride `yaml:"addressOverrides,omitempty"`
   173  }
   174  
   175  type AddressOverride struct {
   176  	From        string `yaml:"from"`
   177  	To          string `yaml:"to"`
   178  	CACertsFile string `yaml:"caCertsFile"`
   179  }
   180  
   181  type Service struct {
   182  	Enabled       bool   `yaml:"enabled"`
   183  	ListenAddress string `yaml:"listenAddress,omitempty"`
   184  }
   185  
   186  type Handlers struct {
   187  	AuthFilters []Handler  `yaml:"authFilters,omitempty"`
   188  	Decorators  []Handler  `yaml:"decorators,omitempty"`
   189  	Endorsers   HandlerMap `yaml:"endorsers,omitempty"`
   190  	Validators  HandlerMap `yaml:"validators,omitempty"`
   191  }
   192  
   193  type Handler struct {
   194  	Name    string `yaml:"name,omitempty"`
   195  	Library string `yaml:"library,omitempty"`
   196  }
   197  
   198  type HandlerMap map[string]Handler
   199  
   200  type Discovery struct {
   201  	Enabled                      bool    `yaml:"enabled"`
   202  	AuthCacheEnabled             bool    `yaml:"authCacheEnabled"`
   203  	AuthCacheMaxSize             int     `yaml:"authCacheMaxSize,omitempty"`
   204  	AuthCachePurgeRetentionRatio float64 `yaml:"authCachePurgeRetentionRatio"`
   205  	OrgMembersAllowedAccess      bool    `yaml:"orgMembersAllowedAccess"`
   206  }
   207  
   208  type VM struct {
   209  	Endpoint string  `yaml:"endpoint,omitempty"`
   210  	Docker   *Docker `yaml:"docker,omitempty"`
   211  }
   212  
   213  type Docker struct {
   214  	TLS          *TLS               `yaml:"tls,omitempty"`
   215  	AttachStdout bool               `yaml:"attachStdout"`
   216  	HostConfig   *docker.HostConfig `yaml:"hostConfig,omitempty"`
   217  }
   218  
   219  type Chaincode struct {
   220  	Builder          string            `yaml:"builder,omitempty"`
   221  	Pull             bool              `yaml:"pull"`
   222  	Golang           *Golang           `yaml:"golang,omitempty"`
   223  	Java             *Java             `yaml:"java,omitempty"`
   224  	Node             *Node             `yaml:"node,omitempty"`
   225  	InstallTimeout   time.Duration     `yaml:"installTimeout,omitempty"`
   226  	StartupTimeout   time.Duration     `yaml:"startupTimeout,omitempty"`
   227  	ExecuteTimeout   time.Duration     `yaml:"executeTimeout,omitempty"`
   228  	Mode             string            `yaml:"mode,omitempty"`
   229  	Keepalive        int               `yaml:"keepalive,omitempty"`
   230  	System           SystemFlags       `yaml:"system,omitempty"`
   231  	Logging          *Logging          `yaml:"logging,omitempty"`
   232  	ExternalBuilders []ExternalBuilder `yaml:"externalBuilders"`
   233  
   234  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   235  }
   236  
   237  type Golang struct {
   238  	Runtime     string `yaml:"runtime,omitempty"`
   239  	DynamicLink bool   `yaml:"dynamicLink"`
   240  
   241  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   242  }
   243  
   244  type Java struct {
   245  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   246  }
   247  
   248  type Node struct {
   249  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   250  }
   251  
   252  type ExternalBuilder struct {
   253  	EnvironmentWhitelist []string `yaml:"environmentWhitelist,omitempty"`
   254  	Name                 string   `yaml:"name,omitempty"`
   255  	Path                 string   `yaml:"path,omitempty"`
   256  }
   257  
   258  type SystemFlags struct {
   259  	NEWLIFECYCLE string `yaml:"_lifecycle,omitempty"`
   260  	CSCC         string `yaml:"cscc,omitempty"`
   261  	LSCC         string `yaml:"lscc,omitempty"`
   262  	ESCC         string `yaml:"escc,omitempty"`
   263  	VSCC         string `yaml:"vscc,omitempty"`
   264  	QSCC         string `yaml:"qscc,omitempty"`
   265  }
   266  
   267  type Ledger struct {
   268  	// Blockchain - not sure if it's needed
   269  	State   *StateConfig   `yaml:"state,omitempty"`
   270  	History *HistoryConfig `yaml:"history,omitempty"`
   271  }
   272  
   273  type StateConfig struct {
   274  	StateDatabase string         `yaml:"stateDatabase,omitempty"`
   275  	CouchDBConfig *CouchDBConfig `yaml:"couchDBConfig,omitempty"`
   276  }
   277  
   278  type CouchDBConfig struct {
   279  	CouchDBAddress          string        `yaml:"couchDBAddress,omitempty"`
   280  	Username                string        `yaml:"username,omitempty"`
   281  	Password                string        `yaml:"password,omitempty"`
   282  	MaxRetries              int           `yaml:"maxRetries,omitempty"`
   283  	MaxRetriesOnStartup     int           `yaml:"maxRetriesOnStartup,omitempty"`
   284  	RequestTimeout          time.Duration `yaml:"requestTimeout,omitempty"`
   285  	QueryLimit              int           `yaml:"queryLimit,omitempty"`
   286  	MaxBatchUpdateSize      int           `yaml:"maxBatchUpdateSize,omitempty"`
   287  	WarmIndexesAfterNBlocks int           `yaml:"warmIndexesAfteNBlocks,omitempty"`
   288  }
   289  
   290  type HistoryConfig struct {
   291  	EnableHistoryDatabase bool `yaml:"enableHistoryDatabase"`
   292  }
   293  
   294  type Operations struct {
   295  	ListenAddress string `yaml:"listenAddress,omitempty"`
   296  	TLS           *TLS   `yaml:"tls"`
   297  }
   298  
   299  type Metrics struct {
   300  	Provider string  `yaml:"provider"`
   301  	Statsd   *Statsd `yaml:"statsd,omitempty"`
   302  }
   303  
   304  type Statsd struct {
   305  	Network       string        `yaml:"network,omitempty"`
   306  	Address       string        `yaml:"address,omitempty"`
   307  	WriteInterval time.Duration `yaml:"writeInterval,omitempty"`
   308  	Prefix        string        `yaml:"prefix,omitempty"`
   309  }