config

package
v1.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host         string `toml:"host" json:"host"`
	Port         int    `toml:"port" json:"port"`
	Store        string `toml:"store" json:"store"`
	Path         string `toml:"path" json:"path"`
	Socket       string `toml:"socket" json:"socket"`
	BinlogSocket string `toml:"binlog-socket" json:"binlog-socket"`
	Lease        string `toml:"lease" json:"lease"`
	RunDDL       bool   `toml:"run-ddl" json:"run-ddl"`
	SplitTable   bool   `toml:"split-table" json:"split-table"`
	TokenLimit   int    `toml:"token-limit" json:"token-limit"`
	EnableChunk  bool   `toml:"enable-chunk" json:"enable-chunk"`

	Log               Log               `toml:"log" json:"log"`
	Security          Security          `toml:"security" json:"security"`
	Status            Status            `toml:"status" json:"status"`
	Performance       Performance       `toml:"performance" json:"performance"`
	XProtocol         XProtocol         `toml:"xprotocol" json:"xprotocol"`
	PlanCache         PlanCache         `toml:"plan-cache" json:"plan-cache"`
	PreparedPlanCache PreparedPlanCache `toml:"prepared-plan-cache" json:"prepared-plan-cache"`
	OpenTracing       OpenTracing       `toml:"opentracing" json:"opentracing"`
	ProxyProtocol     ProxyProtocol     `toml:"proxy-protocol" json:"proxy-protocol"`
	TiKVClient        TiKVClient        `toml:"tikv-client" json:"tikv-client"`
}

Config contains configuration options.

func GetGlobalConfig

func GetGlobalConfig() *Config

GetGlobalConfig returns the global configuration for this server. It should store configuration from command line and configuration file. Other parts of the system can read the global configuration use this function.

func NewConfig

func NewConfig() *Config

NewConfig creates a new config instance with default value.

func (*Config) Load

func (c *Config) Load(confFile string) error

Load loads config options from a toml file.

type Log

type Log struct {
	// Log level.
	Level string `toml:"level" json:"level"`
	// Log format. one of json, text, or console.
	Format string `toml:"format" json:"format"`
	// Disable automatic timestamps in output.
	DisableTimestamp bool `toml:"disable-timestamp" json:"disable-timestamp"`
	// File log config.
	File logutil.FileLogConfig `toml:"file" json:"file"`

	SlowQueryFile  string `toml:"slow-query-file" json:"slow-query-file"`
	SlowThreshold  int    `toml:"slow-threshold" json:"slow-threshold"`
	QueryLogMaxLen int    `toml:"query-log-max-len" json:"query-log-max-len"`
}

Log is the log section of config.

func (*Log) ToLogConfig

func (l *Log) ToLogConfig() *logutil.LogConfig

ToLogConfig converts *Log to *logutil.LogConfig.

type OpenTracing

type OpenTracing struct {
	Enable     bool                `toml:"enable" json:"enbale"`
	Sampler    OpenTracingSampler  `toml:"sampler" json:"sampler"`
	Reporter   OpenTracingReporter `toml:"reporter" json:"reporter"`
	RPCMetrics bool                `toml:"rpc-metrics" json:"rpc-metrics"`
}

OpenTracing is the opentracing section of the config.

func (*OpenTracing) ToTracingConfig

func (t *OpenTracing) ToTracingConfig() *tracing.Configuration

ToTracingConfig converts *OpenTracing to *tracing.Configuration.

type OpenTracingReporter

type OpenTracingReporter struct {
	QueueSize           int           `toml:"queue-size" json:"queue-size"`
	BufferFlushInterval time.Duration `toml:"buffer-flush-interval" json:"buffer-flush-interval"`
	LogSpans            bool          `toml:"log-spans" json:"log-spans"`
	LocalAgentHostPort  string        `toml:"local-agent-host-port" json:"local-agent-host-port"`
}

OpenTracingReporter is the config for opentracing reporter. See https://godoc.org/github.com/uber/jaeger-client-go/config#ReporterConfig

type OpenTracingSampler

type OpenTracingSampler struct {
	Type                    string        `toml:"type" json:"type"`
	Param                   float64       `toml:"param" json:"param"`
	SamplingServerURL       string        `toml:"sampling-server-url" json:"sampling-server-url"`
	MaxOperations           int           `toml:"max-operations" json:"max-operations"`
	SamplingRefreshInterval time.Duration `toml:"sampling-refresh-interval" json:"sampling-refresh-interval"`
}

OpenTracingSampler is the config for opentracing sampler. See https://godoc.org/github.com/uber/jaeger-client-go/config#SamplerConfig

type Performance

type Performance struct {
	MaxProcs        int    `toml:"max-procs" json:"max-procs"`
	TCPKeepAlive    bool   `toml:"tcp-keep-alive" json:"tcp-keep-alive"`
	RetryLimit      int    `toml:"retry-limit" json:"retry-limit"`
	JoinConcurrency int    `toml:"join-concurrency" json:"join-concurrency"`
	CrossJoin       bool   `toml:"cross-join" json:"cross-join"`
	StatsLease      string `toml:"stats-lease" json:"stats-lease"`
	RunAutoAnalyze  bool   `toml:"run-auto-analyze" json:"run-auto-analyze"`
}

Performance is the performance section of the config.

type PlanCache

type PlanCache struct {
	Enabled  bool  `toml:"enabled" json:"enabled"`
	Capacity int64 `toml:"capacity" json:"capacity"`
	Shards   int64 `toml:"shards" json:"shards"`
}

PlanCache is the PlanCache section of the config.

type PreparedPlanCache

type PreparedPlanCache struct {
	Enabled  bool  `toml:"enabled" json:"enabled"`
	Capacity int64 `toml:"capacity" json:"capacity"`
}

PreparedPlanCache is the PreparedPlanCache section of the config.

type ProxyProtocol

type ProxyProtocol struct {
	// PROXY protocol acceptable client networks.
	// Empty string means disable PROXY protocol,
	// * means all networks.
	Networks string `toml:"networks" json:"networks"`
	// PROXY protocol header read timeout, Unit is second.
	HeaderTimeout int `toml:"header-timeout" json:"header-timeout"`
}

ProxyProtocol is the PROXY protocol section of the config.

type Security

type Security struct {
	SkipGrantTable bool   `toml:"skip-grant-table" json:"skip-grant-table"`
	SSLCA          string `toml:"ssl-ca" json:"ssl-ca"`
	SSLCert        string `toml:"ssl-cert" json:"ssl-cert"`
	SSLKey         string `toml:"ssl-key" json:"ssl-key"`
	ClusterSSLCA   string `toml:"cluster-ssl-ca" json:"cluster-ssl-ca"`
	ClusterSSLCert string `toml:"cluster-ssl-cert" json:"cluster-ssl-cert"`
	ClusterSSLKey  string `toml:"cluster-ssl-key" json:"cluster-ssl-key"`
}

Security is the security section of the config.

func (*Security) ToTLSConfig

func (s *Security) ToTLSConfig() (*tls.Config, error)

ToTLSConfig generates tls's config based on security section of the config.

type Status

type Status struct {
	ReportStatus    bool   `toml:"report-status" json:"report-status"`
	StatusPort      int    `toml:"status-port" json:"status-port"`
	MetricsAddr     string `toml:"metrics-addr" json:"metrics-addr"`
	MetricsInterval int    `toml:"metrics-interval" json:"metrics-interval"`
}

Status is the status section of the config.

type TiKVClient

type TiKVClient struct {
	// GrpcConnectionCount is the max gRPC connections that will be established
	// with each tikv-server.
	GrpcConnectionCount int `toml:"grpc-connection-count" json:"grpc-connection-count"`
}

TiKVClient is the config for tikv client.

type XProtocol

type XProtocol struct {
	XServer bool   `toml:"xserver" json:"xserver"`
	XHost   string `toml:"xhost" json:"xhost"`
	XPort   int    `toml:"xport" json:"xport"`
	XSocket string `toml:"xsocket" json:"xsocket"`
}

XProtocol is the XProtocol section of the config.

Jump to

Keyboard shortcuts

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