server

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "0.7.4"

	// DOLTGRES_DATA_DIR is an environment variable that defines the location of DoltgreSQL databases
	DOLTGRES_DATA_DIR = "DOLTGRES_DATA_DIR"
	// DOLTGRES_DATA_DIR_DEFAULT is the portion to append to the user's home directory if DOLTGRES_DATA_DIR has not been specified
	DOLTGRES_DATA_DIR_DEFAULT = "doltgres/databases"

	DefUserName  = "postres"
	DefUserEmail = "postgres@somewhere.com"
	DoltgresDir  = "doltgres"
)
View Source
const (
	OverrideDataDirKey = "data_dir"
)

Variables

View Source
var ConfigHelp = `Place holder. This will be replaced with details on config.yaml options`

Functions

func NewListener

func NewListener(listenerCfg mysql.ListenerConfig) (server.ProtocolListener, error)

NewListener creates a new Listener.

func NewListenerWithOpts added in v0.5.0

func NewListenerWithOpts(listenerCfg mysql.ListenerConfig, opts ...ListenerOpt) (server.ProtocolListener, error)

func Ptr added in v0.7.4

func Ptr[T any](v T) *T

func RunInMemory

func RunInMemory(cfg *DoltgresConfig) (*svcs.Controller, error)

RunInMemory starts the server based on the given args, while also using RAM as the backing store. The returned WaitGroup may be used to wait for the server to close.

func RunOnDisk

func RunOnDisk(ctx context.Context, cfg *DoltgresConfig, dEnv *env.DoltEnv) (*svcs.Controller, error)

RunOnDisk starts the server based on the given args, while also using the local disk as the backing store. The returned WaitGroup may be used to wait for the server to close.

Types

type ConnectionHandler added in v0.4.0

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

ConnectionHandler is responsible for the entire lifecycle of a user connection: receiving messages they send, executing queries, sending the correct messages in return, and terminating the connection when appropriate.

func NewConnectionHandler added in v0.4.0

func NewConnectionHandler(conn net.Conn, handler mysql.Handler) *ConnectionHandler

NewConnectionHandler returns a new ConnectionHandler for the connection provided

func (*ConnectionHandler) Conn added in v0.4.0

func (h *ConnectionHandler) Conn() net.Conn

Conn returns the underlying net.Conn for this connection.

func (*ConnectionHandler) HandleConnection added in v0.4.0

func (h *ConnectionHandler) HandleConnection()

HandleConnection handles a connection's session, reading messages, executing queries, and sending responses. Expected to run in a goroutine per connection.

type ConvertedQuery added in v0.2.0

type ConvertedQuery struct {
	String string
	AST    vitess.Statement
}

ConvertedQuery represents a query that has been converted from the Postgres representation to the Vitess representation. String may contain the string version of the converted query. AST will contain the tree version of the converted query, and is the recommended form to use. If AST is nil, then use the String version, otherwise always prefer to AST.

type DoltgesMetricsConfig added in v0.7.4

type DoltgesMetricsConfig struct {
	Labels map[string]string `yaml:"labels,omitempty" minver:"0.7.4"`
	Host   *string           `yaml:"host,omitempty" minver:"0.7.4"`
	Port   *int              `yaml:"port,omitempty" minver:"0.7.4"`
}

type DoltgresBehaviorConfig added in v0.7.4

type DoltgresBehaviorConfig struct {
	ReadOnly *bool `yaml:"read_only,omitempty" minver:"0.7.4"`
	// 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,omitempty" minver:"0.7.4"`
	// DoltTransactionCommit enables the @@dolt_transaction_commit system variable, which
	// automatically creates a Dolt commit when any SQL transaction is committed.
	DoltTransactionCommit *bool `yaml:"dolt_transaction_commit,omitempty" minver:"0.7.4"`
}

BehaviorYAMLConfig contains server configuration regarding how the server should behave

type DoltgresConfig added in v0.7.4

type DoltgresConfig struct {
	LogLevelStr       *string                    `yaml:"log_level,omitempty" minver:"0.7.4"`
	MaxLenInLogs      *int                       `yaml:"max_query_len_in_logs,omitempty" minver:"0.7.4"`
	EncodeLoggedQuery *bool                      `yaml:"encode_logged_query,omitempty" minver:"0.7.4"`
	BehaviorConfig    *DoltgresBehaviorConfig    `yaml:"behavior,omitempty" minver:"0.7.4"`
	UserConfig        *DoltgresUserConfig        `yaml:"user,omitempty" minver:"0.7.4"`
	ListenerConfig    *DoltgresListenerConfig    `yaml:"listener,omitempty" minver:"0.7.4"`
	PerformanceConfig *DoltgresPerformanceConfig `yaml:"performance,omitempty" minver:"0.7.4"`
	DataDirStr        *string                    `yaml:"data_dir,omitempty" minver:"0.7.4"`
	CfgDirStr         *string                    `yaml:"cfg_dir,omitempty" minver:"0.7.4"`
	MetricsConfig     *DoltgesMetricsConfig      `yaml:"metrics,omitempty" minver:"0.7.4"`
	RemotesapiConfig  *DoltgresRemotesapiConfig  `yaml:"remotesapi,omitempty" minver:"0.7.4"`
	PrivilegeFile     *string                    `yaml:"privilege_file,omitempty" minver:"0.7.4"`
	BranchControlFile *string                    `yaml:"branch_control_file,omitempty" minver:"0.7.4"`

	// TODO: Rename to UserVars_
	Vars            []DoltgresUserSessionVars `yaml:"user_session_vars,omitempty" minver:"0.7.4"`
	SystemVariables *engine.SystemVariables   `yaml:"system_variables,omitempty" minver:"0.7.4"`
	Jwks            []engine.JwksConfig       `yaml:"jwks,omitempty" minver:"0.7.4"`
	GoldenMysqlConn *string                   `yaml:"golden_mysql_conn,omitempty" minver:"0.7.4"`

	PostgresReplicationConfig *PostgresReplicationConfig `yaml:"postgres_replication,omitempty" minver:"0.7.4"`
}

func ConfigFromYamlData added in v0.7.4

func ConfigFromYamlData(configFileData []byte, overrides map[string]string) (*DoltgresConfig, error)

func ReadConfigFromYamlFile added in v0.7.4

func ReadConfigFromYamlFile(fs filesys.Filesys, configFilePath string, overrides map[string]string) (*DoltgresConfig, error)

func (*DoltgresConfig) AllowCleartextPasswords added in v0.7.4

func (cfg *DoltgresConfig) AllowCleartextPasswords() bool

func (*DoltgresConfig) AutoCommit added in v0.7.4

func (cfg *DoltgresConfig) AutoCommit() bool

func (*DoltgresConfig) BranchControlFilePath added in v0.7.4

func (cfg *DoltgresConfig) BranchControlFilePath() string

func (*DoltgresConfig) CfgDir added in v0.7.4

func (cfg *DoltgresConfig) CfgDir() string

func (*DoltgresConfig) ClusterConfig added in v0.7.4

func (cfg *DoltgresConfig) ClusterConfig() cluster.Config

func (*DoltgresConfig) DataDir added in v0.7.4

func (cfg *DoltgresConfig) DataDir() string

func (*DoltgresConfig) DisableClientMultiStatements added in v0.7.4

func (cfg *DoltgresConfig) DisableClientMultiStatements() bool

func (*DoltgresConfig) DoltTransactionCommit added in v0.7.4

func (cfg *DoltgresConfig) DoltTransactionCommit() bool

func (*DoltgresConfig) EventSchedulerStatus added in v0.7.4

func (cfg *DoltgresConfig) EventSchedulerStatus() string

func (*DoltgresConfig) Host added in v0.7.4

func (cfg *DoltgresConfig) Host() string

func (*DoltgresConfig) JwksConfig added in v0.7.4

func (cfg *DoltgresConfig) JwksConfig() []engine.JwksConfig

func (*DoltgresConfig) LogLevel added in v0.7.4

func (cfg *DoltgresConfig) LogLevel() sqlserver.LogLevel

func (*DoltgresConfig) MaxConnections added in v0.7.4

func (cfg *DoltgresConfig) MaxConnections() uint64

func (*DoltgresConfig) MaxLoggedQueryLen added in v0.7.4

func (cfg *DoltgresConfig) MaxLoggedQueryLen() int

func (*DoltgresConfig) MetricsHost added in v0.7.4

func (cfg *DoltgresConfig) MetricsHost() string

func (*DoltgresConfig) MetricsLabels added in v0.7.4

func (cfg *DoltgresConfig) MetricsLabels() map[string]string

func (*DoltgresConfig) MetricsPort added in v0.7.4

func (cfg *DoltgresConfig) MetricsPort() int

func (*DoltgresConfig) Password added in v0.7.4

func (cfg *DoltgresConfig) Password() string

func (*DoltgresConfig) PersistenceBehavior added in v0.7.4

func (cfg *DoltgresConfig) PersistenceBehavior() string

func (*DoltgresConfig) Port added in v0.7.4

func (cfg *DoltgresConfig) Port() int

func (*DoltgresConfig) PrivilegeFilePath added in v0.7.4

func (cfg *DoltgresConfig) PrivilegeFilePath() string

func (*DoltgresConfig) QueryParallelism added in v0.7.4

func (cfg *DoltgresConfig) QueryParallelism() int

func (*DoltgresConfig) ReadOnly added in v0.7.4

func (cfg *DoltgresConfig) ReadOnly() bool

func (*DoltgresConfig) ReadTimeout added in v0.7.4

func (cfg *DoltgresConfig) ReadTimeout() uint64

func (*DoltgresConfig) RemotesapiPort added in v0.7.4

func (cfg *DoltgresConfig) RemotesapiPort() *int

func (*DoltgresConfig) RemotesapiReadOnly added in v0.7.4

func (cfg *DoltgresConfig) RemotesapiReadOnly() *bool

func (*DoltgresConfig) RequireSecureTransport added in v0.7.4

func (cfg *DoltgresConfig) RequireSecureTransport() bool

func (*DoltgresConfig) ShouldEncodeLoggedQuery added in v0.7.4

func (cfg *DoltgresConfig) ShouldEncodeLoggedQuery() bool

func (*DoltgresConfig) Socket added in v0.7.4

func (cfg *DoltgresConfig) Socket() string

func (*DoltgresConfig) SystemVars added in v0.7.4

func (cfg *DoltgresConfig) SystemVars() engine.SystemVariables

func (*DoltgresConfig) TLSCert added in v0.7.4

func (cfg *DoltgresConfig) TLSCert() string

func (*DoltgresConfig) TLSKey added in v0.7.4

func (cfg *DoltgresConfig) TLSKey() string

func (*DoltgresConfig) ToSqlServerConfig added in v0.7.4

func (cfg *DoltgresConfig) ToSqlServerConfig() sqlserver.ServerConfig

func (*DoltgresConfig) User added in v0.7.4

func (cfg *DoltgresConfig) User() string

func (*DoltgresConfig) UserVars added in v0.7.4

func (cfg *DoltgresConfig) UserVars() []sqlserver.UserSessionVars

func (*DoltgresConfig) ValueSet added in v0.7.4

func (cfg *DoltgresConfig) ValueSet(value string) bool

func (*DoltgresConfig) WriteTimeout added in v0.7.4

func (cfg *DoltgresConfig) WriteTimeout() uint64

type DoltgresListenerConfig added in v0.7.4

type DoltgresListenerConfig struct {
	HostStr            *string `yaml:"host,omitempty" minver:"0.7.4"`
	PortNumber         *int    `yaml:"port,omitempty" minver:"0.7.4"`
	ReadTimeoutMillis  *uint64 `yaml:"read_timeout_millis,omitempty" minver:"0.7.4"`
	WriteTimeoutMillis *uint64 `yaml:"write_timeout_millis,omitempty" minver:"0.7.4"`
	// TLSKey is a file system path to an unencrypted private TLS key in PEM format.
	TLSKey *string `yaml:"tls_key,omitempty" minver:"0.7.4"`
	// TLSCert is a file system path to a TLS certificate chain in PEM format.
	TLSCert *string `yaml:"tls_cert,omitempty" minver:"0.7.4"`
	// RequireSecureTransport can enable a mode where non-TLS connections are turned away.
	RequireSecureTransport *bool `yaml:"require_secure_transport,omitempty" minver:"0.7.4"`
	// AllowCleartextPasswords enables use of cleartext passwords.
	AllowCleartextPasswords *bool `yaml:"allow_cleartext_passwords,omitempty" minver:"0.7.4"`
	// Socket is unix socket file path
	Socket *string `yaml:"socket,omitempty" minver:"0.7.4"`
}

DoltgresListenerConfig contains information on the network connection that the server will open

type DoltgresPerformanceConfig added in v0.7.4

type DoltgresPerformanceConfig struct {
	QueryParallelism *int `yaml:"query_parallelism,omitempty" minver:"0.7.4"`
}

DoltgresPerformanceConfig contains configuration parameters for performance tweaking

type DoltgresRemotesapiConfig added in v0.7.4

type DoltgresRemotesapiConfig struct {
	Port     *int  `yaml:"port,omitempty" minver:"0.7.4"`
	ReadOnly *bool `yaml:"read_only,omitempty" minver:"0.7.4"`
}

type DoltgresUserConfig added in v0.7.4

type DoltgresUserConfig struct {
	Name     *string `yaml:"name,omitempty" minver:"0.7.4"`
	Password *string `yaml:"password,omitempty" minver:"0.7.4"`
}

type DoltgresUserSessionVars added in v0.7.4

type DoltgresUserSessionVars struct {
	Name string            `yaml:"name"`
	Vars map[string]string `yaml:"vars,omitempty"`
}

type Listener

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

Listener listens for connections to process PostgreSQL requests into Dolt requests.

func (*Listener) Accept

func (l *Listener) Accept()

Accept handles incoming connections.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr returns the address that the listener is listening on.

func (*Listener) Close

func (l *Listener) Close()

Close stops the handling of incoming connections.

type ListenerOpt added in v0.5.0

type ListenerOpt func(*Listener)

func WithCertificate added in v0.5.0

func WithCertificate(cert tls.Certificate) ListenerOpt

type PortalData added in v0.4.0

type PortalData struct {
	Query        ConvertedQuery
	IsEmptyQuery bool
	Fields       []*querypb.Field
	BoundPlan    sql.Node
}

type PostgresReplicationConfig added in v0.5.0

type PostgresReplicationConfig struct {
	PostgresServerAddress *string `yaml:"postgres_server_address,omitempty" minver:"0.7.4"`
	PostgresUser          *string `yaml:"postgres_user,omitempty" minver:"0.7.4"`
	PostgresPassword      *string `yaml:"postgres_password,omitempty" minver:"0.7.4"`
	PostgresDatabase      *string `yaml:"postgres_database,omitempty" minver:"0.7.4"`
	PostgresPort          *int    `yaml:"postgres_port,omitempty" minver:"0.7.4"`
	SlotName              *string `yaml:"slot_name,omitempty" minver:"0.7.4"`
}

type PreparedStatementData added in v0.4.0

type PreparedStatementData struct {
	Query        ConvertedQuery
	ReturnFields []*querypb.Field
	BindVarTypes []int32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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