github.com/go-graphite/carbonapi@v0.17.0/zipper/types/backend.go (about)

     1  package types
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/go-graphite/carbonapi/pkg/tlsconfig"
     7  )
     8  
     9  type BackendsV2 struct {
    10  	Backends                  []BackendV2   `mapstructure:"backends"`
    11  	MaxIdleConnsPerHost       int           `mapstructure:"maxIdleConnsPerHost"`
    12  	ConcurrencyLimitPerServer int           `mapstructure:"concurrencyLimit"`
    13  	Timeouts                  Timeouts      `mapstructure:"timeouts"`
    14  	KeepAliveInterval         time.Duration `mapstructure:"keepAliveInterval"`
    15  	MaxTries                  int           `mapstructure:"maxTries"`
    16  	MaxBatchSize              *int          `mapstructure:"maxBatchSize"`
    17  }
    18  
    19  type BackendV2 struct {
    20  	GroupName                 string                 `mapstructure:"groupName"`
    21  	Protocol                  string                 `mapstructure:"protocol"`
    22  	LBMethod                  string                 `mapstructure:"lbMethod"` // Valid: rr/roundrobin, broadcast/all
    23  	Servers                   []string               `mapstructure:"servers"`
    24  	Timeouts                  *Timeouts              `mapstructure:"timeouts"`
    25  	ConcurrencyLimit          *int                   `mapstructure:"concurrencyLimit"`
    26  	KeepAliveInterval         *time.Duration         `mapstructure:"keepAliveInterval"`
    27  	MaxIdleConnsPerHost       *int                   `mapstructure:"maxIdleConnsPerHost"`
    28  	MaxTries                  *int                   `mapstructure:"maxTries"`
    29  	MaxBatchSize              *int                   `mapstructure:"maxBatchSize"`
    30  	BackendOptions            map[string]interface{} `mapstructure:"backendOptions"`
    31  	ForceAttemptHTTP2         bool                   `mapstructure:"forceAttemptHTTP2"`
    32  	DoMultipleRequestsIfSplit bool                   `mapstructure:"doMultipleRequestsIfSplit"`
    33  	IdleConnectionTimeout     *time.Duration         `mapstructure:"idleConnectionTimeout"`
    34  	TLSClientConfig           *tlsconfig.TLSConfig   `mapstructure:"tlsClientConfig"`
    35  }
    36  
    37  func (b *BackendV2) FillDefaults() {
    38  	if b.Timeouts == nil {
    39  		b.Timeouts = &Timeouts{}
    40  	}
    41  
    42  	if b.Timeouts.Render == 0 {
    43  		b.Timeouts.Render = 10000 * time.Second
    44  	}
    45  
    46  	if b.Timeouts.Find == 0 {
    47  		b.Timeouts.Find = 10000 * time.Second
    48  	}
    49  
    50  	if b.Timeouts.Connect == 0 {
    51  		b.Timeouts.Connect = 200 * time.Millisecond
    52  	}
    53  }