Documentation ¶
Index ¶
- func ConfigInfo(config ServerConfig) string
- func ConnectionString(config ServerConfig) string
- func DefaultServerConfig() *commandLineServerConfig
- func LoadTLSConfig(cfg ServerConfig) (*tls.Config, error)
- func Serve(ctx context.Context, version string, serverConfig ServerConfig, ...) (startError error, closeError error)
- func ValidateConfig(config ServerConfig) error
- type BehaviorYAMLConfig
- type DatabaseYAMLConfig
- type ListenerYAMLConfig
- type LogFormat
- type LogLevel
- type MetricsYAMLConfig
- type MysqlRowWrapper
- type PerformanceYAMLConfig
- type ServerConfig
- type ServerController
- type SqlClientCmd
- func (cmd SqlClientCmd) ArgParser() *argparser.ArgParser
- func (cmd SqlClientCmd) CreateMarkdown(wr io.Writer, commandStr string) error
- func (cmd SqlClientCmd) Description() string
- func (cmd SqlClientCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int
- func (cmd SqlClientCmd) Hidden() bool
- func (cmd SqlClientCmd) Name() string
- func (cmd SqlClientCmd) RequiresRepo() bool
- type SqlServerCmd
- func (cmd SqlServerCmd) ArgParser() *argparser.ArgParser
- func (cmd SqlServerCmd) CreateMarkdown(wr io.Writer, commandStr string) error
- func (cmd SqlServerCmd) Description() string
- func (cmd SqlServerCmd) EventType() eventsapi.ClientEventType
- func (cmd SqlServerCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int
- func (cmd SqlServerCmd) Name() string
- func (cmd SqlServerCmd) RequiresRepo() bool
- type UserYAMLConfig
- type YAMLConfig
- func (cfg YAMLConfig) AutoCommit() bool
- func (cfg YAMLConfig) DataDir() string
- func (cfg YAMLConfig) DatabaseNamesAndPaths() []env.EnvNameAndPath
- func (cfg YAMLConfig) DisableClientMultiStatements() bool
- func (cfg YAMLConfig) Host() string
- func (cfg YAMLConfig) LogLevel() LogLevel
- func (cfg YAMLConfig) MaxConnections() uint64
- func (cfg YAMLConfig) MetricsHost() string
- func (cfg YAMLConfig) MetricsLabels() map[string]string
- func (cfg YAMLConfig) MetricsPort() int
- func (cfg YAMLConfig) Password() string
- func (cfg YAMLConfig) PersistenceBehavior() string
- func (cfg YAMLConfig) Port() int
- func (cfg YAMLConfig) PrivilegeFilePath() string
- func (cfg YAMLConfig) QueryParallelism() int
- func (cfg YAMLConfig) ReadOnly() bool
- func (cfg YAMLConfig) ReadTimeout() uint64
- func (cfg YAMLConfig) RequireSecureTransport() bool
- func (cfg YAMLConfig) String() string
- func (cfg YAMLConfig) TLSCert() string
- func (cfg YAMLConfig) TLSKey() string
- func (cfg YAMLConfig) User() string
- func (cfg YAMLConfig) WriteTimeout() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigInfo ¶
func ConfigInfo(config ServerConfig) string
ConfigInfo returns a summary of some of the config which contains some of the more important information
func ConnectionString ¶
func ConnectionString(config ServerConfig) string
ConnectionString returns a Data Source Name (DSN) to be used by go clients for connecting to a running server.
func DefaultServerConfig ¶
func DefaultServerConfig() *commandLineServerConfig
DefaultServerConfig creates a `*ServerConfig` that has all of the options set to their default values.
func LoadTLSConfig ¶
func LoadTLSConfig(cfg ServerConfig) (*tls.Config, error)
LoadTLSConfig loads the certificate chain from config.TLSKey() and config.TLSCert() and returns a *tls.Config configured for its use. Returns `nil` if key and cert are `""`.
func Serve ¶
func Serve( ctx context.Context, version string, serverConfig ServerConfig, serverController *ServerController, dEnv *env.DoltEnv, ) (startError error, closeError error)
Serve starts a MySQL-compatible server. Returns any errors that were encountered.
func ValidateConfig ¶
func ValidateConfig(config ServerConfig) error
Validate returns an `error` if any field is not valid.
Types ¶
type BehaviorYAMLConfig ¶
type BehaviorYAMLConfig struct { ReadOnly *bool `yaml:"read_only"` AutoCommit *bool // PersistenceBehavior regulates loading persisted system variable configuration. PersistenceBehavior *string `yaml:"persistence_behavior"` // Disable processing CLIENT_MULTI_STATEMENTS support on the // sql server. Dolt's handling of CLIENT_MULTI_STATEMENTS is currently // broken. If a client advertises to support it (mysql cli client // does), and then sends statements that contain embedded unquoted ';'s // (such as a CREATE TRIGGER), then those incoming queries will be // misprocessed. DisableClientMultiStatements *bool `yaml:"disable_client_multi_statements"` }
BehaviorYAMLConfig contains server configuration regarding how the server should behave
type DatabaseYAMLConfig ¶
DatabaseYAMLConfig contains information on a database that this server will provide access to
type ListenerYAMLConfig ¶
type ListenerYAMLConfig struct { HostStr *string `yaml:"host"` PortNumber *int `yaml:"port"` MaxConnections *uint64 `yaml:"max_connections"` ReadTimeoutMillis *uint64 `yaml:"read_timeout_millis"` WriteTimeoutMillis *uint64 `yaml:"write_timeout_millis"` // TLSKey is a file system path to an unencrypted private TLS key in PEM format. TLSKey *string `yaml:"tls_key"` // TLSCert is a file system path to a TLS certificate chain in PEM format. TLSCert *string `yaml:"tls_cert"` // RequireSecureTransport can enable a mode where non-TLS connections are turned away. RequireSecureTransport *bool `yaml:"require_secure_transport"` }
ListenerYAMLConfig contains information on the network connection that the server will open
type LogLevel ¶
type LogLevel string
LogLevel defines the available levels of logging for the server.
type MetricsYAMLConfig ¶
type MysqlRowWrapper ¶
type MysqlRowWrapper struct {
// contains filtered or unexported fields
}
func NewMysqlRowWrapper ¶
func NewMysqlRowWrapper(rows *mysql.Rows) (*MysqlRowWrapper, error)
func (*MysqlRowWrapper) HasMoreRows ¶
func (s *MysqlRowWrapper) HasMoreRows() bool
func (*MysqlRowWrapper) Schema ¶
func (s *MysqlRowWrapper) Schema() sql.Schema
type PerformanceYAMLConfig ¶
type PerformanceYAMLConfig struct {
QueryParallelism *int `yaml:"query_parallelism"`
}
PerformanceYAMLConfig contains configuration parameters for performance tweaking
type ServerConfig ¶
type ServerConfig interface { // Host returns the domain that the server will run on. Accepts an IPv4 or IPv6 address, in addition to localhost. Host() string // Port returns the port that the server will run on. The valid range is [1024, 65535]. Port() int // User returns the username that connecting clients must use. User() string // Password returns the password that connecting clients must use. Password() string // ReadTimeout returns the read timeout in milliseconds ReadTimeout() uint64 // WriteTimeout returns the write timeout in milliseconds WriteTimeout() uint64 // ReadOnly returns whether the server will only accept read statements or all statements. ReadOnly() bool // LogLevel returns the level of logging that the server will use. LogLevel() LogLevel // Autocommit defines the value of the @@autocommit session variable used on every connection AutoCommit() bool // DatabaseNamesAndPaths returns an array of env.EnvNameAndPathObjects corresponding to the databases to be loaded in // a multiple db configuration. If nil is returned the server will look for a database in the current directory and // give it a name automatically. DatabaseNamesAndPaths() []env.EnvNameAndPath // DataDir is the path to a directory to use as the data dir, both to create new databases and locate existing ones. DataDir() string // MaxConnections returns the maximum number of simultaneous connections the server will allow. The default is 1 MaxConnections() uint64 // QueryParallelism returns the parallelism that should be used by the go-mysql-server analyzer QueryParallelism() int // TLSKey returns a path to the servers PEM-encoded private TLS key. "" if there is none. TLSKey() string // TLSCert returns a path to the servers PEM-encoded TLS certificate chain. "" if there is none. TLSCert() string // RequireSecureTransport is true if the server should reject non-TLS connections. RequireSecureTransport() bool // PersistenceBehavior is "load" if we include persisted system globals on server init PersistenceBehavior() string // DisableClientMultiStatements is true if we want the server to not // process incoming ComQuery packets as if they had multiple queries in // them, even if the client advertises support for MULTI_STATEMENTS. DisableClientMultiStatements() bool // MetricsLabels returns labels that are applied to all prometheus metrics MetricsLabels() map[string]string MetricsHost() string MetricsPort() int // PrivilegeFilePath returns the path to the file which contains all needed privilege information in the form of a // JSON string. PrivilegeFilePath() string }
ServerConfig contains all of the configurable options for the MySQL-compatible server.
func GetServerConfig ¶
func GetServerConfig(dEnv *env.DoltEnv, apr *argparser.ArgParseResults) (ServerConfig, error)
type ServerController ¶
type ServerController struct {
// contains filtered or unexported fields
}
func NewServerController ¶
func NewServerController() *ServerController
NewServerController creates a `ServerController` for use with synchronizing on `Serve`.
func (*ServerController) StopServer ¶
func (controller *ServerController) StopServer()
StopServer stops the server if it is running. Only the first call will trigger the stop, thus it is safe for multiple goroutines to call this function.
func (*ServerController) WaitForClose ¶
func (controller *ServerController) WaitForClose() error
WaitForClose blocks the caller until the server has closed. The return is the last error encountered, if any.
func (*ServerController) WaitForStart ¶
func (controller *ServerController) WaitForStart() error
WaitForStart blocks the caller until the server has started. An error is returned if one was encountered.
type SqlClientCmd ¶
type SqlClientCmd struct{}
func (SqlClientCmd) ArgParser ¶
func (cmd SqlClientCmd) ArgParser() *argparser.ArgParser
func (SqlClientCmd) CreateMarkdown ¶
func (cmd SqlClientCmd) CreateMarkdown(wr io.Writer, commandStr string) error
func (SqlClientCmd) Description ¶
func (cmd SqlClientCmd) Description() string
func (SqlClientCmd) Hidden ¶
func (cmd SqlClientCmd) Hidden() bool
func (SqlClientCmd) Name ¶
func (cmd SqlClientCmd) Name() string
func (SqlClientCmd) RequiresRepo ¶
func (cmd SqlClientCmd) RequiresRepo() bool
type SqlServerCmd ¶
type SqlServerCmd struct {
VersionStr string
}
func (SqlServerCmd) ArgParser ¶
func (cmd SqlServerCmd) ArgParser() *argparser.ArgParser
func (SqlServerCmd) CreateMarkdown ¶
func (cmd SqlServerCmd) CreateMarkdown(wr io.Writer, commandStr string) error
CreateMarkdown creates a markdown file containing the helptext for the command at the given path
func (SqlServerCmd) Description ¶
func (cmd SqlServerCmd) Description() string
Description returns a description of the command
func (SqlServerCmd) EventType ¶
func (cmd SqlServerCmd) EventType() eventsapi.ClientEventType
EventType returns the type of the event to log
func (SqlServerCmd) Exec ¶
func (cmd SqlServerCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv) int
Exec executes the command
func (SqlServerCmd) Name ¶
func (cmd SqlServerCmd) Name() string
Name is returns the name of the Dolt cli command. This is what is used on the command line to invoke the command
func (SqlServerCmd) RequiresRepo ¶
func (cmd SqlServerCmd) RequiresRepo() bool
RequiresRepo indicates that this command does not have to be run from within a dolt data repository directory. In this case it is because this command supports the multiDBDirFlag which can pass in a directory. In the event that that parameter is not provided there is additional error handling within this command to make sure that this was in fact run from within a dolt data repository directory.
type UserYAMLConfig ¶
UserYAMLConfig contains server configuration regarding the user account clients must use to connect
type YAMLConfig ¶
type YAMLConfig struct { LogLevelStr *string `yaml:"log_level"` BehaviorConfig BehaviorYAMLConfig `yaml:"behavior"` UserConfig UserYAMLConfig `yaml:"user"` ListenerConfig ListenerYAMLConfig `yaml:"listener"` DatabaseConfig []DatabaseYAMLConfig `yaml:"databases"` PerformanceConfig PerformanceYAMLConfig `yaml:"performance"` DataDirStr *string `yaml:"data_dir"` MetricsConfig MetricsYAMLConfig `yaml:"metrics"` PrivilegeFile *string `yaml:"privilege_file"` }
YAMLConfig is a ServerConfig implementation which is read from a yaml file
func NewYamlConfig ¶
func NewYamlConfig(configFileData []byte) (YAMLConfig, error)
func (YAMLConfig) AutoCommit ¶
func (cfg YAMLConfig) AutoCommit() bool
Autocommit defines the value of the @@autocommit session variable used on every connection
func (YAMLConfig) DataDir ¶
func (cfg YAMLConfig) DataDir() string
func (YAMLConfig) DatabaseNamesAndPaths ¶
func (cfg YAMLConfig) DatabaseNamesAndPaths() []env.EnvNameAndPath
DatabaseNamesAndPaths returns an array of env.EnvNameAndPathObjects corresponding to the databases to be loaded in a multiple db configuration. If nil is returned the server will look for a database in the current directory and give it a name automatically.
func (YAMLConfig) DisableClientMultiStatements ¶
func (cfg YAMLConfig) DisableClientMultiStatements() bool
DisableClientMultiStatements returns true if the server should run in a mode where the CLIENT_MULTI_STATEMENTS option are ignored and every incoming ComQuery packet is assumed to be a standalone query.
func (YAMLConfig) Host ¶
func (cfg YAMLConfig) Host() string
Host returns the domain that the server will run on. Accepts an IPv4 or IPv6 address, in addition to localhost.
func (YAMLConfig) LogLevel ¶
func (cfg YAMLConfig) LogLevel() LogLevel
LogLevel returns the level of logging that the server will use.
func (YAMLConfig) MaxConnections ¶
func (cfg YAMLConfig) MaxConnections() uint64
MaxConnections returns the maximum number of simultaneous connections the server will allow. The default is 1
func (YAMLConfig) MetricsHost ¶
func (cfg YAMLConfig) MetricsHost() string
func (YAMLConfig) MetricsLabels ¶
func (cfg YAMLConfig) MetricsLabels() map[string]string
func (YAMLConfig) MetricsPort ¶
func (cfg YAMLConfig) MetricsPort() int
func (YAMLConfig) Password ¶
func (cfg YAMLConfig) Password() string
Password returns the password that connecting clients must use.
func (YAMLConfig) PersistenceBehavior ¶
func (cfg YAMLConfig) PersistenceBehavior() string
func (YAMLConfig) Port ¶
func (cfg YAMLConfig) Port() int
Port returns the port that the server will run on. The valid range is [1024, 65535].
func (YAMLConfig) PrivilegeFilePath ¶
func (cfg YAMLConfig) PrivilegeFilePath() string
func (YAMLConfig) QueryParallelism ¶
func (cfg YAMLConfig) QueryParallelism() int
QueryParallelism returns the parallelism that should be used by the go-mysql-server analyzer
func (YAMLConfig) ReadOnly ¶
func (cfg YAMLConfig) ReadOnly() bool
ReadOnly returns whether the server will only accept read statements or all statements.
func (YAMLConfig) ReadTimeout ¶
func (cfg YAMLConfig) ReadTimeout() uint64
ReadTimeout returns the read timeout in milliseconds.
func (YAMLConfig) RequireSecureTransport ¶
func (cfg YAMLConfig) RequireSecureTransport() bool
func (YAMLConfig) String ¶
func (cfg YAMLConfig) String() string
String returns the YAML representation of the config
func (YAMLConfig) TLSCert ¶
func (cfg YAMLConfig) TLSCert() string
func (YAMLConfig) TLSKey ¶
func (cfg YAMLConfig) TLSKey() string
func (YAMLConfig) User ¶
func (cfg YAMLConfig) User() string
User returns the username that connecting clients must use.
func (YAMLConfig) WriteTimeout ¶
func (cfg YAMLConfig) WriteTimeout() uint64
WriteTimeout returns the write timeout in milliseconds.