config

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHelpRequested      = coderr.NewCodeError(coderr.PrintHelpUsage, "help requested")
	ErrInvalidPeerURL     = coderr.NewCodeError(coderr.InvalidParams, "invalid peers url")
	ErrInvalidCommandArgs = coderr.NewCodeError(coderr.InvalidParams, "invalid command arguments")
	ErrRetrieveHostname   = coderr.NewCodeError(coderr.Internal, "retrieve local hostname")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Log     log.Config `toml:"log" json:"log"`
	EtcdLog log.Config `toml:"etcd-log" json:"etcd-log"`

	GrpcHandleTimeoutMs int64 `toml:"grpc-handle-timeout-ms" json:"grpc-handle-timeout-ms"`
	EtcdStartTimeoutMs  int64 `toml:"etcd-start-timeout-ms" json:"etcd-start-timeout-ms"`
	EtcdCallTimeoutMs   int64 `toml:"etcd-call-timeout-ms" json:"etcd-call-timeout-ms"`

	LeaseTTLSec int64 `toml:"lease-sec" json:"lease-sec"`

	NodeName            string `toml:"node-name" json:"node-name"`
	DataDir             string `toml:"data-dir" json:"data-dir"`
	WalDir              string `toml:"wal-dir" json:"wal-dir"`
	StorageRootPath     string `toml:"storage-root-path" json:"storage-root-path"`
	InitialCluster      string `toml:"initial-cluster" json:"initial-cluster"`
	InitialClusterState string `toml:"initial-cluster-state" json:"initial-cluster-state"`
	InitialClusterToken string `toml:"initial-cluster-token" json:"initial-cluster-token"`
	// TickInterval is the interval for etcd Raft tick.
	TickIntervalMs    int64 `toml:"tick-interval-ms" json:"tick-interval-ms"`
	ElectionTimeoutMs int64 `toml:"election-timeout-ms" json:"election-timeout-ms"`
	// QuotaBackendBytes Raise alarms when backend size exceeds the given quota. 0 means use the default quota.
	// the default size is 2GB, the maximum is 8GB.
	QuotaBackendBytes int64 `toml:"quota-backend-bytes" json:"quota-backend-bytes"`
	// AutoCompactionMode is either 'periodic' or 'revision'. The default value is 'periodic'.
	AutoCompactionMode string `toml:"auto-compaction-mode" json:"auto-compaction-mode"`
	// AutoCompactionRetention is either duration string with time unit
	// (e.g. '5m' for 5-minute), or revision unit (e.g. '5000').
	// If no time unit is provided and compaction mode is 'periodic',
	// the unit defaults to hour. For example, '5' translates into 5-hour.
	// The default retention is 1 hour.
	// Before etcd v3.3.x, the type of retention is int. We add 'v2' suffix to make it backward compatible.
	AutoCompactionRetention string `toml:"auto-compaction-retention" json:"auto-compaction-retention-v2"`
	MaxRequestBytes         uint   `toml:"max-request-bytes" json:"max-request-bytes"`
	MaxScanLimit            int    `toml:"max-scan-limit" json:"max-scan-limit"`
	MinScanLimit            int    `toml:"min-scan-limit" json:"min-scan-limit"`
	IDAllocatorStep         uint   `toml:"id-allocator-step" json:"id-allocator-step"`

	// Following fields are the settings for the default cluster.
	DefaultClusterName              string `toml:"default-cluster-name" json:"default-cluster-name"`
	DefaultClusterNodeCount         int    `toml:"default-cluster-node-count" json:"default-cluster-node-count"`
	DefaultClusterReplicationFactor int    `toml:"default-cluster-replication-factor" json:"default-cluster-replication-factor"`
	DefaultClusterShardTotal        int    `toml:"default-cluster-shard-total" json:"default-cluster-shard-total"`

	ClientUrls          string `toml:"client-urls" json:"client-urls"`
	PeerUrls            string `toml:"peer-urls" json:"peer-urls"`
	AdvertiseClientUrls string `toml:"advertise-client-urls" json:"advertise-client-urls"`
	AdvertisePeerUrls   string `toml:"advertise-peer-urls" json:"advertise-peer-urls"`
}

func (*Config) EtcdCallTimeout

func (c *Config) EtcdCallTimeout() time.Duration

func (*Config) EtcdStartTimeout

func (c *Config) EtcdStartTimeout() time.Duration

func (*Config) GenEtcdConfig

func (c *Config) GenEtcdConfig() (*embed.Config, error)

func (*Config) GrpcHandleTimeout

func (c *Config) GrpcHandleTimeout() time.Duration

func (*Config) ValidateAndAdjust

func (c *Config) ValidateAndAdjust() error

ValidateAndAdjust validates the config fields and adjusts some fields which should be adjusted. Return error if any field is invalid.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser builds the config from the flags.

func MakeConfigParser

func MakeConfigParser() (*Parser, error)

func (*Parser) Parse

func (p *Parser) Parse(arguments []string) (*Config, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL