Documentation ¶
Overview ¶
Package option implements the start-up options.
Index ¶
- func ParseURLs(urlStrings []string) ([]url.URL, error)
- type ClusterOptions
- type Options
- func (opt *Options) FlagUsages() string
- func (opt *Options) GetFirstAdvertiseClientURL() (string, error)
- func (opt *Options) GetPeerURLs() []string
- func (opt *Options) InitialClusterToString() string
- func (opt *Options) Parse() error
- func (opt *Options) UseInitialCluster() bool
- func (opt *Options) YAML() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClusterOptions ¶
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"` TLS bool `yaml:"tls"` CertFile string `yaml:"cert-file"` KeyFile string `yaml:"key-file"` ClientCAFile string `yaml:"client-ca-file"` Debug bool `yaml:"debug"` DisableAccessLog bool `yaml:"disable-access-log"` InitialObjectConfigFiles []string `yaml:"initial-object-config-files"` ObjectsDumpInterval string `yaml:"objects-dump-interval"` BasicAuth map[string]string `yaml:"basic-auth"` // 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"` // 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 (*Options) FlagUsages ¶
FlagUsages export original flag usages, see FlagSet.FlagUsages.
func (*Options) GetFirstAdvertiseClientURL ¶
GetFirstAdvertiseClientURL returns the first advertised client url.
func (*Options) GetPeerURLs ¶
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 ¶
InitialClusterToString returns initial clusters string representation.
func (*Options) Parse ¶
Parse parses all arguments, when the user wants to display version information or view help, we do not execute subsequent logic and return directly.
func (*Options) UseInitialCluster ¶
UseInitialCluster returns true if the cluster.initial-cluster is defined. If it is, the ClusterJoinUrls is ignored.