github.com/osdi23p228/fabric@v0.0.0-20221218062954-77808885f5db/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  	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  
   189  type DeliveryClient struct {
   190  	ReconnectTotalTimeThreshold time.Duration      `yaml:"reconnectTotalTimeThreshold,omitempty"`
   191  	AddressOverrides            []*AddressOverride `yaml:"addressOverrides,omitempty"`
   192  }
   193  
   194  type AddressOverride struct {
   195  	From        string `yaml:"from"`
   196  	To          string `yaml:"to"`
   197  	CACertsFile string `yaml:"caCertsFile"`
   198  }
   199  
   200  type Service struct {
   201  	Enabled       bool   `yaml:"enabled"`
   202  	ListenAddress string `yaml:"listenAddress,omitempty"`
   203  }
   204  
   205  type Handlers struct {
   206  	AuthFilters []Handler  `yaml:"authFilters,omitempty"`
   207  	Decorators  []Handler  `yaml:"decorators,omitempty"`
   208  	Endorsers   HandlerMap `yaml:"endorsers,omitempty"`
   209  	Validators  HandlerMap `yaml:"validators,omitempty"`
   210  }
   211  
   212  type Handler struct {
   213  	Name    string `yaml:"name,omitempty"`
   214  	Library string `yaml:"library,omitempty"`
   215  }
   216  
   217  type HandlerMap map[string]Handler
   218  
   219  type Discovery struct {
   220  	Enabled                      bool    `yaml:"enabled"`
   221  	AuthCacheEnabled             bool    `yaml:"authCacheEnabled"`
   222  	AuthCacheMaxSize             int     `yaml:"authCacheMaxSize,omitempty"`
   223  	AuthCachePurgeRetentionRatio float64 `yaml:"authCachePurgeRetentionRatio"`
   224  	OrgMembersAllowedAccess      bool    `yaml:"orgMembersAllowedAccess"`
   225  }
   226  
   227  type Limits struct {
   228  	Concurrency *Concurrency `yaml:"concurrency,omitempty"`
   229  }
   230  
   231  type Concurrency struct {
   232  	EndorserService int `yaml:"endorserService,omitempty"`
   233  	DeliverService  int `yaml:"deliverService,omitempty"`
   234  }
   235  
   236  type VM struct {
   237  	Endpoint string  `yaml:"endpoint,omitempty"`
   238  	Docker   *Docker `yaml:"docker,omitempty"`
   239  }
   240  
   241  type Docker struct {
   242  	TLS          *TLS               `yaml:"tls,omitempty"`
   243  	AttachStdout bool               `yaml:"attachStdout"`
   244  	HostConfig   *docker.HostConfig `yaml:"hostConfig,omitempty"`
   245  }
   246  
   247  type Chaincode struct {
   248  	Builder          string            `yaml:"builder,omitempty"`
   249  	Pull             bool              `yaml:"pull"`
   250  	Golang           *Golang           `yaml:"golang,omitempty"`
   251  	Java             *Java             `yaml:"java,omitempty"`
   252  	Node             *Node             `yaml:"node,omitempty"`
   253  	InstallTimeout   time.Duration     `yaml:"installTimeout,omitempty"`
   254  	StartupTimeout   time.Duration     `yaml:"startupTimeout,omitempty"`
   255  	ExecuteTimeout   time.Duration     `yaml:"executeTimeout,omitempty"`
   256  	Mode             string            `yaml:"mode,omitempty"`
   257  	Keepalive        int               `yaml:"keepalive,omitempty"`
   258  	System           SystemFlags       `yaml:"system,omitempty"`
   259  	Logging          *Logging          `yaml:"logging,omitempty"`
   260  	ExternalBuilders []ExternalBuilder `yaml:"externalBuilders"`
   261  
   262  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   263  }
   264  
   265  type Golang struct {
   266  	Runtime     string `yaml:"runtime,omitempty"`
   267  	DynamicLink bool   `yaml:"dynamicLink"`
   268  
   269  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   270  }
   271  
   272  type Java struct {
   273  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   274  }
   275  
   276  type Node struct {
   277  	ExtraProperties map[string]interface{} `yaml:",inline,omitempty"`
   278  }
   279  
   280  type ExternalBuilder struct {
   281  	PropagateEnvironment []string `yaml:"propagateEnvironment,omitempty"`
   282  	Name                 string   `yaml:"name,omitempty"`
   283  	Path                 string   `yaml:"path,omitempty"`
   284  }
   285  
   286  type SystemFlags struct {
   287  	NEWLIFECYCLE string `yaml:"_lifecycle,omitempty"`
   288  	CSCC         string `yaml:"cscc,omitempty"`
   289  	LSCC         string `yaml:"lscc,omitempty"`
   290  	ESCC         string `yaml:"escc,omitempty"`
   291  	VSCC         string `yaml:"vscc,omitempty"`
   292  	QSCC         string `yaml:"qscc,omitempty"`
   293  }
   294  
   295  type Ledger struct {
   296  	// Blockchain - not sure if it's needed
   297  	State   *StateConfig   `yaml:"state,omitempty"`
   298  	History *HistoryConfig `yaml:"history,omitempty"`
   299  }
   300  
   301  type StateConfig struct {
   302  	StateDatabase string         `yaml:"stateDatabase,omitempty"`
   303  	CouchDBConfig *CouchDBConfig `yaml:"couchDBConfig,omitempty"`
   304  }
   305  
   306  type CouchDBConfig struct {
   307  	CouchDBAddress          string        `yaml:"couchDBAddress,omitempty"`
   308  	Username                string        `yaml:"username,omitempty"`
   309  	Password                string        `yaml:"password,omitempty"`
   310  	MaxRetries              int           `yaml:"maxRetries,omitempty"`
   311  	MaxRetriesOnStartup     int           `yaml:"maxRetriesOnStartup,omitempty"`
   312  	RequestTimeout          time.Duration `yaml:"requestTimeout,omitempty"`
   313  	QueryLimit              int           `yaml:"queryLimit,omitempty"`
   314  	MaxBatchUpdateSize      int           `yaml:"maxBatchUpdateSize,omitempty"`
   315  	WarmIndexesAfterNBlocks int           `yaml:"warmIndexesAfteNBlocks,omitempty"`
   316  }
   317  
   318  type HistoryConfig struct {
   319  	EnableHistoryDatabase bool `yaml:"enableHistoryDatabase"`
   320  }
   321  
   322  type Operations struct {
   323  	ListenAddress string `yaml:"listenAddress,omitempty"`
   324  	TLS           *TLS   `yaml:"tls"`
   325  }
   326  
   327  type Metrics struct {
   328  	Provider string  `yaml:"provider"`
   329  	Statsd   *Statsd `yaml:"statsd,omitempty"`
   330  }
   331  
   332  type Statsd struct {
   333  	Network       string        `yaml:"network,omitempty"`
   334  	Address       string        `yaml:"address,omitempty"`
   335  	WriteInterval time.Duration `yaml:"writeInterval,omitempty"`
   336  	Prefix        string        `yaml:"prefix,omitempty"`
   337  }