engine

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// QueryCounter describes a metric that accumulates number of queries monotonically.
	QueryCounter = discard.NewCounter()

	// QueryErrorCounter describes a metric that accumulates number of failed queries monotonically.
	QueryErrorCounter = discard.NewCounter()

	// QueryHistogram describes a queries latency.
	QueryHistogram = discard.NewHistogram()
)

Functions

func Schema

func Schema(table string) (o sql.Schema)

Creates a schema for a site table. Each site is treated as an individual read only table.

Physically timestamps are stored as int64, but we expose this a DateTime.

func Table

func Table(name string) *core.Table

Types

type Auth

type Auth struct {
	DB *badger.DB
}

func (Auth) AuthMethod

func (a Auth) AuthMethod(user, addr string) (string, error)

func (Auth) Negotiate

func (a Auth) Negotiate(c *mysql.Conn, user string, remoteAddr net.Addr) (mysql.Getter, error)

func (Auth) Salt

func (a Auth) Salt() ([]byte, error)

func (Auth) ValidateHash

func (a Auth) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (mysql.Getter, error)

type Engine

type Engine struct {
	DB *RadOnly
	*sqle.Engine
}

func Get

func Get(ctx context.Context) *Engine

func New

func New() *Engine

func Open

func Open(ctx context.Context) (context.Context, *Engine)

func (*Engine) Add added in v0.0.25

func (e *Engine) Add(name string)

func (*Engine) Remove added in v0.0.25

func (e *Engine) Remove(name string)

type Handler

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

Handler is a connection handler for a SQLe engine, implementing the Vitess mysql.Handler interface.

func (*Handler) ComInitDB

func (h *Handler) ComInitDB(c *mysql.Conn, schemaName string) error

func (*Handler) ComMultiQuery

func (h *Handler) ComMultiQuery(
	c *mysql.Conn,
	query string,
	callback func(*sqltypes.Result, bool) error,
) (string, error)

func (*Handler) ComPrepare

func (h *Handler) ComPrepare(c *mysql.Conn, query string) ([]*query.Field, error)

ComPrepare parses, partially analyzes, and caches a prepared statement's plan with the given [c.ConnectionID].

func (*Handler) ComQuery

func (h *Handler) ComQuery(
	c *mysql.Conn,
	query string,
	callback func(*sqltypes.Result, bool) error,
) error

ComQuery executes a SQL query on the SQLe engine.

func (*Handler) ComResetConnection

func (h *Handler) ComResetConnection(c *mysql.Conn)

func (*Handler) ComStmtExecute

func (h *Handler) ComStmtExecute(c *mysql.Conn, prepare *mysql.PrepareData, callback func(*sqltypes.Result) error) error

func (*Handler) ConnectionClosed

func (h *Handler) ConnectionClosed(c *mysql.Conn)

ConnectionClosed reports that a connection has been closed.

func (*Handler) NewConnection

func (h *Handler) NewConnection(c *mysql.Conn)

NewConnection reports that a new connection has been established.

func (*Handler) ParserOptionsForConnection

func (h *Handler) ParserOptionsForConnection(c *mysql.Conn) (sqlparser.ParserOptions, error)

func (*Handler) WarningCount

func (h *Handler) WarningCount(c *mysql.Conn) uint16

WarningCount is called at the end of each query to obtain the value to be returned to the client in the EOF packet. Note that this will be called either in the context of the ComQuery callback if the result does not contain any fields, or after the last ComQuery call completes.

type Provider

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

func (*Provider) AllDatabases

func (p *Provider) AllDatabases(_ *sql.Context) []sql.Database

func (*Provider) Database

func (p *Provider) Database(_ *sql.Context, name string) (sql.Database, error)

func (*Provider) HasDatabase

func (p *Provider) HasDatabase(_ *sql.Context, name string) bool

type RadOnly

type RadOnly struct {
	*core.Database
}

func Database

func Database(name string) *RadOnly

func (RadOnly) IsReadOnly

func (r RadOnly) IsReadOnly() bool

type Server added in v0.0.24

type Server struct {
	*mysql.Listener
}

func Listen added in v0.0.24

func Listen(ctx context.Context) (*Server, error)

func (*Server) Close added in v0.0.24

func (s *Server) Close() error

func (*Server) Start added in v0.0.24

func (s *Server) Start() error

type StaticUserData

type StaticUserData string

func (StaticUserData) Get

Get returns the wrapped username and groups

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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