option

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseURLs added in v1.4.0

func ParseURLs(urlStrings []string) ([]url.URL, error)

ParseURLs parses list of strings to url.URL objects.

Types

type ClusterOptions added in v1.4.0

type ClusterOptions struct {
	// Primary members define following URLs to form a cluster.
	ListenPeerURLs           []string          `yaml:"listen-peer-urls"`
	ListenClientURLs         []string          `yaml:"listen-client-urls"`
	AdvertiseClientURLs      []string          `yaml:"advertise-client-urls"`
	InitialAdvertisePeerURLs []string          `yaml:"initial-advertise-peer-urls"`
	InitialCluster           map[string]string `yaml:"initial-cluster"`
	StateFlag                string            `yaml:"state-flag"`
	// Secondary members define URLs to connect to cluster formed by primary members.
	PrimaryListenPeerURLs []string `yaml:"primary-listen-peer-urls"`
	MaxCallSendMsgSize    int      `yaml:"max-call-send-msg-size"`
}

ClusterOptions defines the cluster members.

type Options

type Options struct {

	// Flags from command line only.
	ShowVersion     bool   `yaml:"-"`
	ShowHelp        bool   `yaml:"-"`
	ShowConfig      bool   `yaml:"-"`
	ConfigFile      string `yaml:"-"`
	ForceNewCluster bool   `yaml:"-"`
	SignalUpgrade   bool   `yaml:"-"`

	// meta
	Name                     string            `yaml:"name" env:"EG_NAME"`
	Labels                   map[string]string `yaml:"labels" env:"EG_LABELS"`
	APIAddr                  string            `yaml:"api-addr"`
	Debug                    bool              `yaml:"debug"`
	DisableAccessLog         bool              `yaml:"disable-access-log"`
	InitialObjectConfigFiles []string          `yaml:"initial-object-config-files"`

	// cluster options
	UseStandaloneEtcd     bool           `yaml:"use-standalone-etcd"`
	ClusterName           string         `yaml:"cluster-name"`
	ClusterRole           string         `yaml:"cluster-role"`
	ClusterRequestTimeout string         `yaml:"cluster-request-timeout"`
	Cluster               ClusterOptions `yaml:"cluster"`
	// Deprecated. Use ClusterOptions instead.
	ClusterListenClientURLs         []string `yaml:"cluster-listen-client-urls"`
	ClusterListenPeerURLs           []string `yaml:"cluster-listen-peer-urls"`
	ClusterAdvertiseClientURLs      []string `yaml:"cluster-advertise-client-urls"`
	ClusterInitialAdvertisePeerURLs []string `yaml:"cluster-initial-advertise-peer-urls"`
	ClusterJoinURLs                 []string `yaml:"cluster-join-urls"`

	// Path.
	HomeDir   string `yaml:"home-dir"`
	DataDir   string `yaml:"data-dir"`
	WALDir    string `yaml:"wal-dir"`
	LogDir    string `yaml:"log-dir"`
	MemberDir string `yaml:"member-dir"`

	// Profile.
	CPUProfileFile    string `yaml:"cpu-profile-file"`
	MemoryProfileFile string `yaml:"memory-profile-file"`

	// Status
	StatusUpdateMaxBatchSize int `yaml:"status-update-max-batch-size"`

	// Prepare the items below in advance.
	AbsHomeDir   string `yaml:"-"`
	AbsDataDir   string `yaml:"-"`
	AbsWALDir    string `yaml:"-"`
	AbsLogDir    string `yaml:"-"`
	AbsMemberDir string `yaml:"-"`
	// contains filtered or unexported fields
}

Options is the start-up options.

func New

func New() *Options

New creates a default Options.

func (*Options) GetFirstAdvertiseClientURL added in v1.4.0

func (opt *Options) GetFirstAdvertiseClientURL() (string, error)

GetFirstAdvertiseClientURL returns the first advertised client url.

func (*Options) GetPeerURLs added in v1.4.0

func (opt *Options) GetPeerURLs() []string

GetPeerURLs returns URLs listed in cluster.initial-cluster for primary (a.k.a writer) and for secondary (a.k.a reader) the ones listed in cluster.primary-listen-peer-url.

func (*Options) InitialClusterToString added in v1.4.0

func (opt *Options) InitialClusterToString() string

InitialClusterToString returns initial clusters string representation.

func (*Options) Parse

func (opt *Options) Parse() (string, error)

Parse parses all arguments, returns normal message without error if --help/--version set.

func (*Options) UseInitialCluster added in v1.4.0

func (opt *Options) UseInitialCluster() bool

UseInitialCluster returns true if the cluster.initial-cluster is defined. If it is, the ClusterJoinUrls is ignored.

func (*Options) YAML

func (opt *Options) YAML() string

YAML returns yaml string of option, need to be called after calling Parse.

Jump to

Keyboard shortcuts

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