engine

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 41 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()
)
View Source
var Columns = func() (o []storev1.Column) {
	for i := storev1.Column_bounce; i <= storev1.Column_utm_term; i++ {
		o = append(o, i)
	}
	return
}()

Functions

func Schema

func Schema(table string, columns []storev1.Column) (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.

Types

type Auth

type Auth struct {
	DB db.Provider
}

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 Context added in v0.0.29

type Context struct {
	DB     db.Provider
	Reader b3.Reader
}

type DB added in v0.0.28

type DB struct {
	Context
}

func (*DB) GetTableInsensitive added in v0.0.28

func (db *DB) GetTableInsensitive(ctx *sql.Context, tblName string) (table sql.Table, ok bool, err error)

func (*DB) GetTableNames added in v0.0.28

func (db *DB) GetTableNames(ctx *sql.Context) (names []string, err error)

func (DB) IsReadOnly added in v0.0.28

func (DB) IsReadOnly() bool

func (DB) Name added in v0.0.28

func (DB) Name() string

type Engine

type Engine struct {
	*sqle.Engine
}

func Get

func Get(ctx context.Context) *Engine

func New

func New(ctx Context) *Engine

func Open

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

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 Partition added in v0.0.28

type Partition struct {
	RowGroups []int
	Block     ulid.ULID
}

func (*Partition) Key added in v0.0.28

func (p *Partition) Key() []byte

type Provider

type Provider struct {
	Context
}

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 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

type Table

type Table struct {
	Context
	// contains filtered or unexported fields
}

func (*Table) Collation added in v0.0.28

func (t *Table) Collation() sql.CollationID

func (*Table) Name added in v0.0.28

func (t *Table) Name() string

func (*Table) PartitionRows added in v0.0.28

func (t *Table) PartitionRows(ctx *sql.Context, p sql.Partition) (sql.RowIter, error)

func (*Table) Partitions added in v0.0.28

func (t *Table) Partitions(*sql.Context) (sql.PartitionIter, error)

func (*Table) Projections added in v0.0.28

func (t *Table) Projections() (o []string)

func (*Table) Schema added in v0.0.28

func (t *Table) Schema() sql.Schema

func (*Table) String added in v0.0.28

func (t *Table) String() string

func (*Table) WithProjections added in v0.0.28

func (t *Table) WithProjections(colNames []string) sql.Table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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